#include<sys/types.h> #include<sys/stat.h> #include<unistd.h> #include<stdio.h> main(int argc,char **argv) { struct stat buf; if(stat(argv[1],&buf)==-1) { perror("stat"); return; } printf("size=%u\n",(unsigned int)buf.st_size); printf("mode=%u\n",(unsigned int)buf.st_size); }
file name:madan
welcome madan reddy hyderabad always truth winsOutPut:
madan@madan-Lenovo-G570:~/madan/osconcepts$ ./a.out madan size=48 mode=48