Re: C, really portable?
- From: jacob navia <jacob@xxxxxxxxxxxxxxxx>
- Date: Mon, 12 Dec 2005 01:15:42 +0100
Eric Sosman wrote:
jacob navia wrote:3) If there is an error you do a sloppy job like assuming any error is a disk full error.
Thanks for your assessment of my code. I'm just the sloppiest guy going.
Well, that's what *I* do <grin>.
I assume that if fprintf returns a negative value the disk is full.
It is the only portable thing I can do without tying the code to some specific printf implementation.
It would be much better if I could portable write
err = fprintf(...);
if (err == EOF) {
// no space. Erase temporary files
}This could be encapsulated in a
int MyFprintf(FILE *f,char *fmt,...)
{
int err = fprintf(... /*call ellided*/);
switch (err) {
case EOF:
// No space. Erase temp files
break;
default:
// Other errors
}
return err;
}
.- Follow-Ups:
- Re: C, really portable?
- From: Mark McIntyre
- Re: C, really portable?
- From: Skarmander
- Re: C, really portable?
- References:
- C, really portable?
- From: pemo
- Re: C, really portable?
- From: jacob navia
- Re: C, really portable?
- From: Mark McIntyre
- Re: C, really portable?
- From: jacob navia
- Re: C, really portable?
- From: Mark McIntyre
- Re: C, really portable?
- From: Eric Sosman
- Re: C, really portable?
- From: Malcolm
- Re: C, really portable?
- From: jacob navia
- Re: C, really portable?
- From: Eric Sosman
- C, really portable?
- Prev by Date: Re: Weird lcc-win32 behaviour
- Next by Date: Re: C, really portable?
- Previous by thread: Re: C, really portable?
- Next by thread: Re: C, really portable?
- Index(es):
Relevant Pages
|