/* 2010-05 johnpfeiffer experimenting with directories and files */
#include <stdio.h>
#include <sys\stat.h>
#include <dirent.h>
/* struct stat stbuf; */
int main( int argc, char* argv[] )
{
DIR* dptr; /* directory pointer from dirent.h, acts like a FILE pointer */
struct dirent* direntptr; /* C defined struct containing OS file information */
dptr = NULL;
dptr = opendir("\\");
if( dptr == NULL )
{ printf("error");
}
else
{
/* currently an endless loop because c:\* is returned!, FIX IT! */
while( dptr != NULL )
{
printf("%s", dptr->dd_name ); /* dd_name from mingw port, original = name */
direntptr = readdir( dptr );
}
}
closedir( dptr );
return 0;
}