----- Original Message ----- 
From: "Pablo Manalastas" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, April 02, 2003 5:51 PM
Subject: Re: [plug] Segmentation Fault


> The correct way of writing this piece of code is:
> 
> extern int stat(const char *filename, struct stat *buf);
> int result;
> struct stat buff;
> result = stat("/etc/passwd", &buff);

or maintain using the pointer buff (pbuff) variable:

 extern int stat(const char *filename, struct stat *buf);
 int result;
 struct stat *pbuff;
 pbuf = (struct stat *) malloc(sizeof(struct stat));
 result = stat("/etc/passwd", pbuff);

fooler.


_
Philippine Linux Users Group. Web site and archives at http://plug.linux.org.ph
To leave: send "unsubscribe" in the body to [EMAIL PROTECTED]

Fully Searchable Archives With Friendly Web Interface at http://marc.free.net.ph

To subscribe to the Linux Newbies' List: send "subscribe" in the body to [EMAIL 
PROTECTED]

Reply via email to