Back to index

glibc  2.9
iofwrite.c File Reference
#include "libioP.h"

Go to the source code of this file.


_IO_size_t _IO_fwrite (void *buf, _IO_size_t size, _IO_size_t count, _IO_FILE *fp) const

Function Documentation

_IO_size_t _IO_fwrite ( void *  buf,
_IO_size_t  size,
_IO_size_t  count,
_IO_FILE fp 
) const

Definition at line 32 of file iofwrite.c.

  _IO_size_t request = size * count;
  _IO_size_t written = 0;
  CHECK_FILE (fp, 0);
  if (request == 0)
    return 0;
  _IO_acquire_lock (fp);
  if (_IO_vtable_offset (fp) != 0 || _IO_fwide (fp, -1) == -1)
    written = _IO_sputn (fp, (const char *) buf, request);
  _IO_release_lock (fp);
  /* We have written all of the input in case the return value indicates
     this or EOF is returned.  The latter is a special case where we
     simply did not manage to flush the buffer.  But the data is in the
     buffer and therefore written as far as fwrite is concerned.  */
  if (written == request || written == EOF)
    return count;
    return written / size;

Here is the call graph for this function: