Re: [gtk-list] Re: General C question - file attributes



>On Sun, Aug 15, 1999 at 09:25:55AM -0400, John C Atkeson wrote:
>>
>>   I'm reading directories with opendir, readdir and closedir.   Um... how
>I was looking for these... glad I read your question.
>> do I detect file attributes, specifically how to distinguish files from
>> sub-directories?
>In the man page for readdir I found this:
>              struct dirent {
>                      long            d_ino;  /* inode number */
>                      off_t           d_off;  /* offset to the next dirent
*/
>                      unsigned short  d_reclen;/* length of this record */
>                      unsigned char   d_type;         /* type of file */
>                      char            d_name[256];    /* filename */
>              };
>That is what is returned from readdir, this is just a guess but I would
think
>that d_type is what you are looking for.


    Should probably be better to use the stat() function (don't remember the
    man page... Something like (2) - perhaps (3))

    Yours,

        Emmanuel
>--
>
>Travis Loyd <lelandg@usa.net>
>[Replace PGP with GPG today! http://www.gnupg.org [*] Support .RFC 2015. ]
>




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]