🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.os.linux.development.apps
3 messages
3 total messages Started by Darin Arrick Wed, 06 Sep 1995 22:13
Linux - Error : storage size of var not known
#3
Author: Darin Arrick
Date: Wed, 06 Sep 1995 22:13
31 lines
1501 bytes
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 */
    }
}

-------- END INCLUDED CODE FRAGMENT --------

+-----------------------------------+------------------------------------+
| Darin Arrick, KB5KHR              | Network Cybernetics Corporation    |
| darrick@ncc.com                   |                                    |
+-----------------------------------+------------------------------------+
Re: Linux - Error : storage size of var not known
#2
Author: Jake Odell
Date: Thu, 07 Sep 1995 04:59
41 lines
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
Re: Linux - Error : storage size of var not known
#4
Author: halasz
Date: Thu, 07 Sep 1995 05:52
11 lines
849 bytes
In article <42l6dl$ra6@news.onramp.net>, darrick@ncc.com (Darin Arrick) writes
v storage size of 'stbuf' is not known
v ....
v     struct stat stbuf;

If 'struct stat' is not declared, the size of "stbuf" is not known.
You included "stat.h"
	#include <stat.h>
or
	#include <sys/stat.h>
?  In anie case, look up the usage of "stat" in your book or "man"-page.
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