Article View: comp.os.linux.development.apps
Article #2Re: Linux - Error : storage size of var not known
From: Jake Odell
Date: Thu, 07 Sep 1995 04:59
Date: Thu, 07 Sep 1995 04:59
41 lines
1784 bytes
1784 bytes
Darin Arrick (darrick@ncc.com) wrote:
: I am trying to use the stat() function under Linux, and am getting the
: error:
: storage size of 'stbuf' is not known
: What is causing this? Code fragment is below. E-mail answer is preferable.
: Thank you in advance.
: -------- BEGIN INCLUDED CODE FRAGMENT --------
: void fred(void)
: {
: char *name;
: struct stat stbuf;
: /* also tried "struct new_stat stbuf;" */
: /* it seems Linux has struct old_stat (functionally the same as struct stat)
: and new_stat (old_stat with some other fields) */
: if(stat(name, &stbuf) != NULL)
: {
: /* do something */
: }
: }
Shouldn't you include sys/types.h & sys/stat.h?
Isn't the return of stat 0 on success and -1 on failure? (the opposite
sense that you use it)
: -------- END INCLUDED CODE FRAGMENT --------
: +-----------------------------------+------------------------------------+
: | Darin Arrick, KB5KHR | Network Cybernetics Corporation |
: | darrick@ncc.com | |
: +-----------------------------------+------------------------------------+
--
jake@pantheon.us.com jodell@netcom.com
Technical Details
Message-ID:
<jodellDEIr6M.57s@netcom.com>Path:
arc1-ca.pugleaf.net!netcom.com!jodellReferences:
<42l6dl$ra6@news.onramp.net>Show Full Headers
Complete Article Headers
Newsgroups: comp.os.linux.development.apps,comp.lang.c,comp.unix.programmer Path: arc1-ca.pugleaf.net!netcom.com!jodell From: jodell@netcom.com (Jake Odell) Subject: Re: Linux - Error : storage size of var not known Message-ID: <jodellDEIr6M.57s@netcom.com> Followup-To: comp.os.linux.development.apps,comp.lang.c,comp.unix.programmer Organization: NETCOM On-line Communication Services (408 261-4700 guest) X-Newsreader: TIN [version 1.2 PL1] References: <42l6dl$ra6@news.onramp.net> Date: Thu, 7 Sep 1995 04:59:10 GMT Sender: jodell@netcom15.netcom.com