Re: Stat mod time

From: Mr. Wizard (jsbarrow@husc.harvard.edu)
Date: 09/07/94


On Wed, 7 Sep 1994, Matt Read wrote:

> Ok, thanks for all the help - things were looking good until...
> 
> This is the code I've got:
> 
> struct stat *statbuf;

The variable statbuf is a pointer to a stat struct.

> time_t modified_time;
> 
> stat(MOTD_FILE, statbuf);
> modified_time = statbuf.st_mtime;          /* this is line 1722 in the code */

You've forgotten to dereference your pointer.  Try this:

modified_time = statbuf->st_mtime;
 
> And this is the error message I get:
> 
> interpreter.c:1722: request for member `st_mtime' in something not a structure or union

The 'something not a structure' is a pointer to a structure.  Pointers 
have no members.

> I get the feeling that it's something really obvious that I'd would have
> noticed before my 3 weeks holiday away from C and computers...but at the 
> moment, someone else is gonna have to do my dirty work for me.

It's been a while for me, so i hope I didn't just stick my foot in my 
mouth.  :)
	
> 	Thanks, Free.

##=====================###================================================##
||  Joshua Sky Barrow  ||| Harvard University Faculty of Arts and Science ||
##=====================###================================================##
|| 19 Central St., #28 ||| "If you can imagine it, you can achieve it.    ||
|| Somerville, MA      |||  If you can dream it, you can become it."      ||
|| 02143-3832          |||                                   Unknown      ||
##=====================###================================================##
|| (617) 666-0859      ||| E-mail:  jsbarrow@fas.harvard.edu              ||
##=====================###================================================##



This archive was generated by hypermail 2b30 : 12/07/00 PST