🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by "Paul Ditchfield Fri, 18 Aug 2000 00:00
Problem with <stat.h> HELP!!
#99975
Author: "Paul Ditchfield
Date: Fri, 18 Aug 2000 00:00
48 lines
1299 bytes
> Hi there,
>                I hope someone can give me some help on this very quickly.  I have a project to do
> for university which involves the use of the stat system call.  For some reason the gcc compiler
> keeps telling me that 'mode_t' is undeclared, even though it is a type, defined in <stat.h>.  If I
> actually cut and paste the definition of 'mode_t' from <stat.h> directly to my little test program
> it works!! so why does it not see it in the header file??!!
>
> Here is the little test program.  The problem is that when I try to compile it I get an eror
saying
> that 'mode_t' is undeclared.  This is strange because 'mode_t' is defined as a type in <stat.h>
and
> as I said, cutting and pasting the definition of 'mode_t' from the header file into my test
routine
> actually works!!  Please please let me know what is going on, why is gcc ignoring the definition
of
> 'mode_t' in the <stat.h> header file?
>
> #include <unistd.h>
> #include <sys/stat.h>
> #include <stdlib.h>
> #include <stdio.h>
>
> int main (int argc, char *argv[])
>
> {
>
>    struct stat buf;
>    mode_t mode;
>
>
>    stat(argv[1], &buf);
>
>    mode = buf.st_mode;
>
>    printf("\n\n%d\n\n", mode);
>
>    return 0;
>
> }
>
> Thanks in adavance,
>
>                                      Paul.
>
>
>
>
>
>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads