Testing directory suing S_ISDIR,But it doesn't work

view story

http://stackoverflow.com – I'm studying c programming in linux,and I wrote this to output information about the files and directories like the standard tool "ls" with "-l",everything works fine except the macro S_ISDIR,Here is my code. Additionally,my os is mint 14 x86_64. #include<sys/types.h> #include<time.h> #include<string.h> #include<dirent.h> #include<stdio.h> #include<sys/stat.h> #include<unistd.h> void do_ls(char []); void show_file_info(struct stat *t){ printf("mode: %o\n",t->st_mode); if(S_ISDIR(t->st_mode)==0) printf("Is a dir\n"); else (HowTos)