2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
12 /*****************************************************************************
20 const void * restrict buf
,
23 FILE * restrict stream
)
26 Write an amount of bytes to a stream.
29 buf - The buffer to write to the stream
30 size - Size of one block to write
31 nblocks - The number of blocks to write
32 stream - Write to this stream
35 The number of blocks written. If no error occurred, this is
36 nblocks. Otherwise examine errno for the reason of the error.
41 ******************************************************************************/
45 if (size
== 0 || nblocks
== 0)
48 if (!(stream
->flags
& __STDCIO_STDIO_WRITE
))
50 SetIoErr(ERROR_WRITE_PROTECTED
);
52 stream
->flags
|= __STDCIO_STDIO_ERROR
;
56 if ((stream
->flags
& __STDCIO_STDIO_APPEND
))
57 Seek(stream
->fh
, 0, OFFSET_END
);
59 cnt
= FWrite (stream
->fh
, (CONST APTR
)buf
, size
, nblocks
);
63 errno
= __stdc_ioerr2errno (IoErr ());
64 stream
->flags
|= __STDCIO_STDIO_ERROR
;