You are not logged in.

#1 2007-02-11 01:22:16

hypermegachi
Member
Registered: 2004-07-25
Posts: 311

reading creation time of a file in C

hello all, i'm having a problem here...

i've read up on the manual here:
http://www.gnu.org/software/libc/manual … butes.html

and from here (http://www.gnu.org/software/libc/manual … nings.html), it appears that there are no times to read that tell me when the creation time is.  i see last access and modification, but no creation date.

how do i read this in C?  thanks!

Offline

#2 2007-02-11 01:24:21

toofishes
Developer
From: Chicago, IL
Registered: 2006-06-06
Posts: 602
Website

Re: reading creation time of a file in C

'man 2 stat' shows this for the struct:

         struct stat {
             dev_t     st_dev;     /* ID of device containing file */
             ino_t     st_ino;     /* inode number */
             mode_t    st_mode;    /* protection */
             nlink_t   st_nlink;   /* number of hard links */
             uid_t     st_uid;     /* user ID of owner */
             gid_t     st_gid;     /* group ID of owner */
             dev_t     st_rdev;    /* device ID (if special file) */
             off_t     st_size;    /* total size, in bytes */
             blksize_t st_blksize; /* blocksize for filesystem I/O */
             blkcnt_t  st_blocks;  /* number of 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 */
         };

Offline

#3 2007-02-11 01:28:07

hypermegachi
Member
Registered: 2004-07-25
Posts: 311

Re: reading creation time of a file in C

is "status change" supposed to mean creation date?

Offline

#4 2007-02-11 01:43:28

toofishes
Developer
From: Chicago, IL
Registered: 2006-06-06
Posts: 602
Website

Re: reading creation time of a file in C

Linux and Unix file systems do not have a creation date stored, as far as I know, unlike FAT and NFS. They only have the above three fields.

Offline

#5 2007-02-11 10:58:10

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: reading creation time of a file in C

Yeah, I don't think ANY filesystem (or OS) stores file CREATION time, unless you count VMS - as you could just check the mtime of the file "version 1"

Offline

Board footer

Powered by FluxBB