You are declaring a local variable (cstat)inside main()

after the statement in question. C requires that

all local variable declarations occur before any non-

decaration code.

This should compile fine as C++, however.

HTH

-- Joe

Chris Fowler wrote:



> I'm trying to compile this program and if I keep the statements:



> if (argc !=2 )

>         syntax(argv[0]);



> I get parse errors.  I can not figure out where the parse error is.  I'm

> sure I'm overlooking something.  Can anyone here

> see it?



> -- Cut here ---

> #include 

> #include 

> #include 

> #include 



> void syntax(char *progname);  /* Syntax Display Function */



> void main(int argc, char *argv[])

> {

>         if(argc != 2)             /* I get syntax errors If I use this if */

>                 syntax(argv[0]);  /* I get syntax error if I use this  */

>         struct stat cstat;

>         ino_t myino;

>         if(stat(argv[1],&cstat)== -1)

>         {

>                 fprintf(stderr,"error opening file.\n");

>                 syntax(argv[0]);

>         }

>         myino=cstat.st_ino;

>         fprintf(stdout,"%s: %ld\n",argv[1],myino);

> }



> void syntax(char *progname)

> {

>         fprintf(stderr,"Usage: %s:\n",progname);

>         fprintf(stderr,"--------------------------\n");

>         fprintf(stderr,"%s [FILENAME]\n",progname);

>         fprintf(stderr,"\nFILENAME=filename to get inode location\n");

>         exit(1);

> }

> --

> To unsubscribe: mail ">majordomo@ale.org with "unsubscribe ale" in message body.

-- Joe Knapka

* What happens when a mysterious force meets an inscrutable object?


--
To unsubscribe: mail ">majordomo@ale.org with "unsubscribe ale" in message body.