So I have a project where I need to build a small simple text shell that can run, edit, and read files from a directory. I have a small prototype that should work, except when I compile, I receive an error about d_type not found within the struct dirent used in the dirent.h header file.
d = opendir( "." );
c = 0;
while ((de = readdir(d))){
if ((de->de_type) & DT_DIR)
printf( " ( %d Directory: %s ) \n", c++, de->de_name);
}
the variable "de" is of type struct dirent* and is being checked for it's type, and I get the error: 'struct dirent' has no member named 'de_type'
Here's where I'm really stumped and confused: I've compiled this code on both windows(using dev C++), and on Ubuntu(using gcc). I have recieved the same error on both OS's, and when I checked the library used, which is the normal gnu C library I believe, there is a variable there named d_type:
https://www.gnu.org/software/libc/manual/html_node/Directory-Entries.html
I have found other references to a dirent.h file that doesn't because one is in a different library, and if that is the case, how do I load that library so I can compile the code?
Sorry for the long post and many thanks to all who answer!