Listing files in direcotry
Posted: Mon Mar 21, 2011 11:08 am
Greetings I have a question for my first nds project Id like to create a simple file manager reading about it a lot and even started some coding but I have a problem with this:
It allays prints out a message that open dir has failed and Im stuck with it. Includes I am using are :
Code: Select all
DIR *pdir = NULL;
pdir = opendir(".");
struct dirent *pent = NULL;
if (pdir == NULL)
{
printf("opendir() failed");
exit(3);
}
while(pent == readdir(pdir))
{
if (pent == NULL)
{
printf("readdir() failed");
exit(3);
}
printf(pent -> d_name);
}
closedir(pdir);
Code: Select all
#include <nds.h>
#include <fat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>