file.c 298 B

1234567891011121314
  1. #include "__virtualmath.h"
  2. int checkFile(char *dir){
  3. struct stat my_stat;
  4. int status = stat(dir, &my_stat);
  5. if (status != 0)
  6. return 0;
  7. else if (S_ISREG(my_stat.st_mode))
  8. return 1;
  9. else if (S_ISDIR(my_stat.st_mode))
  10. return 2;
  11. else
  12. return 3;
  13. }