fork download
  1. #include <stdio.h>
  2. #include <sys/stat.h>
  3. int main()
  4. {
  5. struct stat s;
  6. if(stat("test.txt",&s)==0)
  7. {
  8. printf("file size : %d bytes \n",s.st_size);
  9. printf("permission : %o \n",s.st_mode&0777);
  10. }
  11. else
  12. {
  13. printf("Error getting file information /n");
  14. }
  15. return 0;
  16. }
Success #stdin #stdout 0.01s 5292KB
stdin
Standard input is empty
stdout
Error getting file information /n