C: <sys/stat.h> functions S_ISLNK, S_ISDIR and S_ISREG behaving oddly?
问题 The code this is taken from compiles fine. It prints file names in a directory with the option of a letter in front of it: either a d , f , l , or o depending on their file type ( o for other). However, I tested it on the directory /etc/network which has a symbolic file called run and it appeared as d ? I've tried re-arranging the order of the if-statements too, but that gives an unsatisfactory output too. Am I using it incorrectly? while ((ent = readdir (dp)) != NULL) { lstat(ent->d_name,