Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <sys/stat.h>
- // #include <sys/types.h>
- using namespace std;
- #define USAGE "stageros <worldfile>"
- int main(int argc, char **argv) {
- struct stat buf;
- int result;
- result = stat("./Makefile", &buf);
- if (result != 0)
- {
- perror ("Failed ^_^");
- }
- else
- {
- cout << "size of the file in bytes: " << buf.st_size << endl;
- cout << "time of creation of the file: " << ctime(&buf.st_ctime) << endl;
- cout << "time of last modification of the file: "<< ctime(& buf.st_mtime) <<endl;
- cout << "time of last access of the file: " << ctime(&buf.st_atime) << endl;
- }
- }
- // struct stat {
- // dev_t st_dev; // Device ID.
- // ino_t st_ino; // File serial number.
- // mode_t st_mode; // File mode.
- // nlink_t st_nlink; // Link count.
- // uid_t st_uid; // User ID of the file's owner.
- // gid_t st_gid; // Group ID of the file's group.
- // dev_t st_rdev; // Device number, if device.
- // off_t ** st_size;** // Size of file, in bytes.
- // blksize_t st_blksize; // Optimal block size for I/O.
- // blkcnt_t st_blocks; // Number 512-byte blocks allocated.
- // time_t st_atime; // Time of last access.
- // time_t st_mtime; // Time of last modification.
- // time_t st_ctime; // Time of last status change
- // };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement