[prev] [index] [next]

The fwrite function

int fwrite(void *b, size_t z, size_t n, FILE *f);
  • uses stream f, which is open for writing
  • writes n data items, each of size z bytes
  • items are taken from memory buffer at address b
  • returns the number of items successfully written (nr)
  • if an error occurs,   0 <= nr < n
  • void* means that buffer b could hold any type