#include <stdio.h>
#include <sys/stat.h>
int main()
{
struct stat s;
if(stat("test.txt",&s)==0)
{
printf("file size : %d bytes \n",s.st_size);
printf("permission : %o \n",s.st_mode&0777);
}
else
{
printf("Error getting file information /n");
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzeXMvc3RhdC5oPgppbnQgbWFpbigpCnsKCXN0cnVjdCBzdGF0IHM7CglpZihzdGF0KCJ0ZXN0LnR4dCIsJnMpPT0wKQoJewoJCXByaW50ZigiZmlsZSBzaXplIDogJWQgYnl0ZXMgXG4iLHMuc3Rfc2l6ZSk7CgkJcHJpbnRmKCJwZXJtaXNzaW9uIDogJW8gXG4iLHMuc3RfbW9kZSYwNzc3KTsKCX0KCWVsc2UKCXsKCQlwcmludGYoIkVycm9yIGdldHRpbmcgZmlsZSBpbmZvcm1hdGlvbiAvbiIpOwoJfQoJcmV0dXJuIDA7Cn0=