Thursday, 4 December 2014

#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 wins
OutPut:
madan@madan-Lenovo-G570:~/madan/osconcepts$ ./a.out madan
size=48
mode=48