Advertisement
Guest User

Untitled

a guest
Nov 28th, 2017
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include <sys/stat.h>
  2. #include <cerrno>
  3. #include <iostream>
  4. #include <cstring>
  5.  
  6. std::string errorString(int errno){
  7.     return std::strerror(errno);
  8. }
  9.  
  10. int main(){
  11.     struct stat sb;
  12.     errno = 0;
  13.     if(stat("/jdfj/", &sb)){
  14.         errorString(errno);
  15.     }
  16.     else{
  17.         std::cout << std::boolalpha << S_ISDIR(sb.st_mode) << std::endl;
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement