fwrite man page on IRIX

Man page or keyword search:  
man Server   31559 pages
apropos Keyword Search (all sections)
Output format
IRIX logo
[printable version]



FREAD(3S)							     FREAD(3S)

NAME
     fread, fwrite - binary input/output

SYNOPSIS
     #include <stdio.h>

     size_t fread (void *ptr, size_t size, size_t nitems, FILE *stream);

     size_t fwrite (const void *ptr, size_t size, size_t nitems, FILE
     *stream);

DESCRIPTION
     fread copies, into an array pointed to by ptr, up to nitems items of data
     from the named input stream, where an item of data is a sequence of bytes
     (not necessarily terminated by a null byte) of length size.  fread stops
     reading bytes if an end-of-file or error condition is encountered while
     reading stream, or if nitems items have been read.	 The file pointer
     associated with stream is positioned following the last byte read, which
     may be at end-of-file.  fread does not change the contents of stream.
     fread returns the number of items read.

     fwrite appends at most nitems items of data from the array pointed to by
     ptr to the named output stream.  fwrite stops appending when it has
     appended nitems items of data or if an error condition is encountered on
     stream.  fwrite does not change the contents of the array pointed to by
     ptr.  fwrite increments the data-printer in the stream by the number of
     bytes written.  If an error occurs, the resulting value of the file-
     position indicator for the stream is indeterminate.  fwrite returns the
     number of items written.

     ferror(3S) may be used to determine if an error occurred in an fread or
     fwrite call.  The ferror(3S) or feof(3S) routines should be used to
     distinguish between an error condition and end-of-file condition.

     The argument size is typically sizeof(*ptr) where the C operator sizeof
     is used to determine the length of an item pointed to by ptr.

SEE ALSO
     exit(2), fcntl(2), lseek(2), read(2), write(2), abort(3C), fclose(3S),
     fopen(3S), ferror(3S), getc(3S), gets(3S), printf(3S), putc(3S),
     puts(3S), scanf(3S), stdio(3S).

NOTE
     To use these functions with direct I/O (see fcntl(2)), it is necessary to
     arrange that the buffers be correctly aligned before any I/O is done.
     One way to do this is:

	  char *caBuffer11;
	  caBuffer11 = memalign(dioinfo.d_mem, 8+100 * dioinfo.d_miniosz);
	  setbuffer(fpOutFile,caBuffer11,8+100 * dioinfo.d_miniosz);

     where the dioinfo structure has been filled in by the F_DIOINFO fcntl

									Page 1

FREAD(3S)							     FREAD(3S)

     request.

DIAGNOSTICS
     Both fread and fwrite always return a nonnegative integer indicating the
     number of items read or written.  This will be equal to nitems unless an
     error occurred, the value of size is zero, or fread or fwrite detect that
     a request has been made to read (or write) more data than is addressable.

									Page 2

[top]

List of man pages available for IRIX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net