example.cpp 809 B

1234567891011121314151617181920212223242526
  1. #include <igl/file_exists.h>
  2. #include <igl/is_dir.h>
  3. #include <igl/is_file.h>
  4. #include <igl/is_readable.h>
  5. #include <igl/is_writable.h>
  6. using namespace igl;
  7. #include <cstdio>
  8. int main(int argc, char * argv[])
  9. {
  10. if(argc <= 1)
  11. {
  12. printf("USAGE:\n ./example [path_1] [path_2] ... [path_n]\n");
  13. return 1;
  14. }
  15. // loop over arguments
  16. for(int i = 1; i < argc; i++)
  17. {
  18. printf("file_exists(%s) --> %s\n",argv[i],(file_exists(argv[i])?"TRUE":"FALSE"));
  19. printf("is_dir(%s) --> %s\n",argv[i],(is_dir(argv[i])?"TRUE":"FALSE"));
  20. printf("is_file(%s) --> %s\n",argv[i],(is_file(argv[i])?"TRUE":"FALSE"));
  21. printf("is_readable(%s) --> %s\n",argv[i],(is_readable(argv[i])?"TRUE":"FALSE"));
  22. printf("is_writable(%s) --> %s\n",argv[i],(is_writable(argv[i])?"TRUE":"FALSE"));
  23. }
  24. return 0;
  25. }