Is there a UNIX equivalent for _finddata_t.time_write?

Is there a UNIX equivalent for _finddata_t.time_write?

Post by goodguy2003 » Sun, 22 Jun 2003 07:14:12



I am porting a program from Windows to Unix. Does anyone know that is
there a UNIX equivalent for  _finddata_t.time_write?

_finddate_t in io.h:
struct _finddata_t {
        unsigned    attrib;
        time_t      time_create;    /* -1 for FAT file systems */
        time_t      time_access;    /* -1 for FAT file systems */
        time_t      time_write;
        _fsize_t    size;
        char        name[260];

Quote:};

dirent in <dirent.h>
struct  dirent {
             ino_t           d_ino;
             off_t           d_off;
             unsigned short  d_reclen;
             char            d_name[1];
     };

I don't see time_write in dirent.

Thanks in advance.

 
 
 

Is there a UNIX equivalent for _finddata_t.time_write?

Post by Derk Gwe » Sun, 22 Jun 2003 07:30:37


# I am porting a program from Windows to Unix. Does anyone know that is
# there a UNIX equivalent for  _finddata_t.time_write?

I see you a io.h and raise you a /usr/include/sys/stat.h.
        struct stat s;
        if (stat(directorypath ++ dirent->name,&s)==0) {
                s.st_mtime
        }

struct stat {
        dev_t     st_dev;               /* inode's device */
        ino_t     st_ino;               /* inode's number */
        mode_t    st_mode;              /* inode protection mode */
        nlink_t   st_nlink;             /* number of hard links */
        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 type */
#ifndef _POSIX_SOURCE
        struct  timespec st_atimespec;  /* time of last access */
        struct  timespec st_mtimespec;  /* time of last data modification */
        struct  timespec st_ctimespec;  /* time of last file status change */
#else
        time_t    st_atime;             /* time of last access */
        long      st_atimensec;         /* nsec of last access */
        time_t    st_mtime;             /* time of last data modification */
        long      st_mtimensec;         /* nsec of last data modification */
        time_t    st_ctime;             /* time of last file status change */
        long      st_ctimensec;         /* nsec of last file status change */
#endif
        off_t     st_size;              /* file size, in bytes */
        int64_t   st_blocks;            /* blocks allocated for file */
        u_int32_t st_blksize;           /* optimal blocksize for I/O */
        u_int32_t st_flags;             /* user defined flags for file */
        u_int32_t st_gen;               /* file generation number */
        int32_t   st_lspare;
        int64_t   st_qspare[2];

Quote:};

# _finddate_t in io.h:
# struct _finddata_t {
#         unsigned    attrib;
#         time_t      time_create;    /* -1 for FAT file systems */
#         time_t      time_access;    /* -1 for FAT file systems */
#         time_t      time_write;
#         _fsize_t    size;
#         char        name[260];
# };
#
#
# dirent in <dirent.h>
# struct  dirent {
#              ino_t           d_ino;
#              off_t           d_off;
#              unsigned short  d_reclen;
#              char            d_name[1];
#      };
#
#
# I don't see time_write in dirent.
#
# Thanks in advance.
#
#

--
Derk Gwen http://derkgwen.250free.com/html/index.html
If you plan to shoplift, let us know.
                            Thanks

 
 
 

Is there a UNIX equivalent for _finddata_t.time_write?

Post by Eric Sosma » Sun, 22 Jun 2003 07:29:08



> I am porting a program from Windows to Unix. Does anyone know that is
> there a UNIX equivalent for  _finddata_t.time_write?

    "man stat".

Quote:> _finddate_t in io.h:
> struct _finddata_t {
>         unsigned    attrib;
>         time_t      time_create;    /* -1 for FAT file systems */
>         time_t      time_access;    /* -1 for FAT file systems */
>         time_t      time_write;
>         _fsize_t    size;
>         char        name[260];
> };

> dirent in <dirent.h>
> struct  dirent {
>              ino_t           d_ino;
>              off_t           d_off;
>              unsigned short  d_reclen;
>              char            d_name[1];
>      };

> I don't see time_write in dirent.

    It isn't there because it doesn't belong there.
Directories don't *contain* files, they *point to* files.
Timestamps, ownership, access permissions, and so on
belong to the file, not to the directory that points to
it -- or the directorIES that point to it.

--

 
 
 

Is there a UNIX equivalent for _finddata_t.time_write?

Post by Frederic Lachass » Sun, 22 Jun 2003 08:18:38



Quote:> I am porting a program from Windows to Unix. Does anyone know that is
> there a UNIX equivalent for  _finddata_t.time_write?

> _finddate_t in io.h:
> struct _finddata_t {
>         unsigned    attrib;
>         time_t      time_create;    /* -1 for FAT file systems */
>         time_t      time_access;    /* -1 for FAT file systems */
>         time_t      time_write;
>         _fsize_t    size;
>         char        name[260];
> };

> dirent in <dirent.h>
> struct  dirent {
>              ino_t           d_ino;
>              off_t           d_off;
>              unsigned short  d_reclen;
>              char            d_name[1];
>      };

> I don't see time_write in dirent.

ASFAIK, you need to use stat() on each file.
 
 
 

1. Is there a UNIX equivalent for _finddata_t.time_write?

I am porting a program from Windows to Unix. Does anyone know that is
there a UNIX equivalent for  _finddata_t.time_write?

_finddate_t in io.h:
struct _finddata_t {
        unsigned    attrib;
        time_t      time_create;    /* -1 for FAT file systems */
        time_t      time_access;    /* -1 for FAT file systems */
        time_t      time_write;
        _fsize_t    size;
        char        name[260];

dirent in <dirent.h>
struct  dirent {
             ino_t           d_ino;
             off_t           d_off;
             unsigned short  d_reclen;
             char            d_name[1];
     };

I don't see time_write in dirent.

Thanks in advance.

2. Netscape 3.01 Java bug.

3. I am new to Unix and Unix Programming HELP!

4. Is it better perl than awk ?

5. This clone thing...am I stupid, or am I right?

6. NTeX's dvips/xdvi in Slackware96 ALWAYS tediously remakes the pk fonts

7. Welcome to comp.unix.questions [Frequent posting]

8. I am with the following error, when i am running lilo...

9. Am I touchy? Or am I right?

10. Am I seeing IPv5, or am I hallucinating?

11. I am buying an Ultra 5 but am lost in part numbers ....

12. I am in text mode, what browser am I running....