Jean-Marc Lasgouttes wrote:
> 
> >>>>> "Lars" == Lars Gullik Bjønnes <[EMAIL PROTECTED]> writes:
> 
> Lars> fwrite is essentially fprintf without buffering. So it should be
> Lars> no problem switching to fprintf. (actually fprintf are
> Lars> preferrable because of the buffering)
> 
> fwrite was used instead of fprintf because it is supposedly faster, I
> think.

Another reason to use this call may be the more prompt error detection of
the write operation. But you check them, see below.

> Lars> BUT it is strange, both fwrite and fprintf are conforming to
> Lars> ANSI C.  Could it be that we are missing a file.close or a
> Lars> file.flush ?
> 
> The file.close() is there. Is the file.flush() necessary?
> 

The flush shouldn't be necessary. But I think, testing the return
codes and errno after fwrite/fprintf is really the best solution
to find an explanation for such error conditions.

Maybe there are various test effects and the file system was full
when testing fwrite while it has some space when using fprintf...

There are always curious side effects to look for. But a bug in
Solaris 2.6 I would search for at last ressort only.

---------------------------------------------------------------
<[EMAIL PROTECTED]>  | beusen unternehmensgruppe senkel
fon: +49 30 549932-62     | Landsberger Allee 392
fax: +49 30 549932-29     | 12681 Berlin, Germany
---------------------------------------------------------------

Reply via email to