fread, fwrite - binary stream input/output


   #include <stdio.h>

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

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


   The  function  fread() reads nmemb items of data, each size bytes long,
   from the stream pointed to by stream,  storing  them  at  the  location
   given by ptr.

   The function fwrite() writes nmemb items of data, each size bytes long,
   to the stream pointed to by stream, obtaining them  from  the  location
   given by ptr.

   For nonlocking counterparts, see unlocked_stdio(3).


   On  success,  fread()  and  fwrite() return the number of items read or
   written.  This number equals the number of bytes transferred only  when
   size  is 1.  If an error occurs, or the end of the file is reached, the
   return value is a short item count (or zero).

   fread() does not distinguish between end-of-file and error, and callers
   must use feof(3) and ferror(3) to determine which occurred.


   For   an   explanation   of   the  terms  used  in  this  section,  see

   Interface          Attribute      Value   
   fread(), fwrite()  Thread safety  MT-Safe 


   POSIX.1-2001, POSIX.1-2008, C89.


   read(2), write(2), feof(3), ferror(3), unlocked_stdio(3)


   This page is part of release 4.09 of the Linux  man-pages  project.   A
   description  of  the project, information about reporting bugs, and the
   latest    version    of    this    page,    can     be     found     at

More Linux Commands

ldap_next_attribute(3) - step through LDAP entry attributes
The ldap_first_attribute() and ldap_next_attribute() routines are used to step through the attributes in an LDAP entry. ldap_first_attribute() takes an entry as

tty(1) - print the file name of the terminal connected to st
Print the file name of the terminal connected to standard input. -s, --silent, --quiet print nothing, only return an exit status --help display this help and ex

Tcl_CreateChannel(3) - procedures for creating and manipulat
Tcl uses a two-layered channel architecture. It provides a generic upper layer to enable C and Tcl programs to perform input and output using the same APIs for

setstate(3) - random number generator - Linux manual page...
The random() function uses a nonlinear additive feedback random number generator employing a default table of size 31 long integers to return successive pseudo-

Tk_FreeBitmap(3) - maintain database of single-plane pixmaps
These procedures manage a collection of bitmaps (one-plane pixmaps) being used by an application. The procedures allow bitmaps to be re-used efficiently, thereb

ScreenCount(3) - Display macros and functions (Man Page)....
The AllPlanes macro returns a value with all bits set to 1 suitable for use in a plane argument to a procedure. The BlackPixel macro returns the black pixel val

Tcl_SetVar(3) - manipulate Tcl variables - Linux man page...
These procedures are used to create, modify, read, and delete Tcl variables from C code. Tcl_SetVar2Ex, Tcl_SetVar, Tcl_SetVar2, and Tcl_ObjSetVar2 will create

XtGetApplicationResources(3) - obtain application resources
The XtGetApplicationResources function first uses the passed widget, which is usually an application shell, to construct a resource name and class list, Then, i

Net::Server::Proto::TCP(3pm) - (unknown subject) (Man Page)
Protocol module for Net::Server. This module implements the SOCK_STREAM socket type under INET (also known as TCP ). See Net::Server::Proto. PARAMETERS There ar

pam_getenvlist(3) - getting the PAM environment (Man Page)
The pam_getenvlist function returns a complete copy of the PAM environment as associated with the handle pamh. The PAM environment variables represent the conte

XContextDependentDrawing(3) - obtain fontset information....
The XFontsOfFontSet function returns a list of one or more XFontStructs and font names for the fonts used by the Xmb and Xwc layers for the given font set. A li

pair_content_sp(3ncurses) - curses screen-pointer extension
This implementation can be configured to provide a set of functions which improve the ability to manage multiple screens. This feature can be added to any of th

We can't live, work or learn in freedom unless the software we use is free.