SHARE
TWEET

Untitled

a guest Feb 20th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <string.h>
  5. #include <sys/stat.h>
  6. // #include <sys/types.h>
  7.  
  8.  
  9.  
  10. using namespace std;
  11. #define USAGE "stageros <worldfile>"
  12.  
  13. int main(int argc, char **argv) {
  14.     struct stat buf;
  15.     int result;
  16.     result = stat("./Makefile", &buf);
  17.  
  18.     if (result != 0)
  19.       {
  20.           perror ("Failed ^_^");
  21.       }
  22.     else
  23.       {
  24.           cout << "size of the file in bytes: " << buf.st_size << endl;
  25.           cout << "time of creation of the file: " << ctime(&buf.st_ctime) << endl;
  26.           cout << "time of last modification of the file: "<< ctime(& buf.st_mtime) <<endl;
  27.           cout << "time of last access of the file: " << ctime(&buf.st_atime) << endl;    
  28.       }
  29.    
  30.    
  31.  
  32. }
  33.  
  34. // struct stat {
  35. //      dev_t st_dev; // Device ID.
  36. //      ino_t st_ino; // File serial number.
  37. //      mode_t st_mode; // File mode.
  38. //      nlink_t st_nlink; // Link count.
  39. //      uid_t st_uid; // User ID of the file's owner.
  40. //      gid_t st_gid; // Group ID of the file's group.
  41. //      dev_t st_rdev; // Device number, if device.
  42. //      off_t ** st_size;** // Size of file, in bytes.
  43. //      blksize_t st_blksize; // Optimal block size for I/O.
  44. //      blkcnt_t st_blocks; // Number 512-byte blocks allocated.
  45. //      time_t st_atime; // Time of last access.
  46. //      time_t st_mtime; // Time of last modification.
  47. //      time_t st_ctime; // Time of last status change
  48. // };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top