I am using this code to list a directory:
struct dirent *dirent = 0;
if((dir = opendir("c:\\DATA")) != 0)
while ((dirent = readdir(store->dir)) != 0)
if( dirent->d_type == DT_REG )
// do something
dirent = 0;
But the d_type of dirent is always DT_UNKNOWN... why is that ?
for info, the files in the directory have been created with
int fd = open("myfile",O_WRONLY|O_CREAT|O_BINARY|O_TRUNC, 0700) and close(fd) has been called before I list the directory.
I can of course check for DT_UNKNOWN instead of DT_REG, but I'd like to know if i am missing something or if there is a reason why I get DT_UNKNOWN.
I am porting from windows... where it return DT_REG...