[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [leafnode-list] fetchnews fails to download bodies

Cornelius Krasel writes:
> In my case, I have the problem that I opened the file with fopen()
> instead of open(). What is the proper way to stat a stream? My
> suggestion which may be completely wrong:
> 	FILE *f;
> 	struct stat st;
> 	f = fopen( "filename", "r" );
> 	fstat(fileno(f), &st);
> However, I don't know whether fileno() is a universally accepted function -
> the man page would indicate not.

As far as I know, fileno() is as portable as stat() is.  Both are
required by Posix and related Unix standards, neither is required by

> On a more general note, in which cases would it be preferable to use
> open()/close()/... and in which cases would it be preferable to use
> fopen()/fclose()/... instead?

It's almost always preferable to use fopen() and friends.

-Larry Jones

How many presents do you think I'd forfeit for just one
clean smack upside Susie's head? -- Calvin

leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list