fwrite(3)


NAME

   fread, fwrite - binary stream input/output

SYNOPSIS

   #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);

DESCRIPTION

   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).

RETURN VALUE

   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.

ATTRIBUTES

   For   an   explanation   of   the  terms  used  in  this  section,  see
   attributes(7).

   ┌──────────────────┬───────────────┬─────────┐
   │InterfaceAttributeValue   │
   ├──────────────────┼───────────────┼─────────┤
   │fread(), fwrite() │ Thread safety │ MT-Safe │
   └──────────────────┴───────────────┴─────────┘

CONFORMING TO

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

SEE ALSO

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

COLOPHON

   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
   https://www.kernel.org/doc/man-pages/.


More Linux Commands

manpages/innetgr.3.html
innetgr(3) - handle network group entries - Linux man page
The netgroup is a SunOS invention. A netgroup database is a list of string triples (hostname, username, domainname) or other netgroup names. Any of the elements

manpages/open.3pm.html
open(3pm) - perl pragma to set default PerlIO layers for inp
Full-fledged support for I/O layers is now implemented provided Perl is configured to use PerlIO as its IO system (which is now the default). The open pragma se

manpages/imaxabs.3.html
imaxabs(3) - compute the absolute value of an integer.......
The abs() function computes the absolute value of the integer argument j. The labs(), llabs() and imaxabs() functions compute the absolute value of the argument

manpages/XDisplayName.3.html
XDisplayName(3) - default error handlers - Linux man page...
Xlib generally calls the programs supplied error handler whenever an error is received. It is not called on BadName errors from OpenFont, LookupColor, or AllocN

manpages/fifo.4.html
fifo(4) - first-in first-out special file, named pipe.......
A FIFO special file (a named pipe) is similar to a pipe, except that it is accessed as part of the file system. It can be opened by multiple processes for readi

manpages/Tk_MapWindow.3.html
Tk_MapWindow(3) - map or unmap a window - Linux manual page
These procedures may be used to map and unmap windows managed by Tk. Tk_MapWindow maps the window given by tkwin, and also creates an X window corresponding to

manpages/mvadd_wchnstr.3ncurses.html
mvadd_wchnstr(3ncurses) - add an array of complex characters
mvadd_wchnstr.3ncurses - These functions copy the (null-terminated) array of complex characters wchstr into the window image structure starting at the current c

manpages/acl_delete_def_file.3.html
acl_delete_def_file(3) - delete a default ACL by filename...
The acl_delete_def_file() function deletes a default ACL from the directory whose pathname is pointed to by the argument path_p. The effective user ID of the pr

manpages/cimag.3.html
cimag(3) - get imaginary part of a complex number (ManPage)
The cimag() function returns the imaginary part of the complex number z. One has: z = creal(z) + I * cimag(z) VERSIONS These functions first appeared in glibc i

manpages/gnutls_alert_get_strname.3.html
gnutls_alert_get_strname(3) - API function - Linux man page
This function will return a string of the name of the alert. RETURNS string corresponding to gnutls_alert_description_t value. SINCE 3.0.0 REPORTING BUGS Report

manpages/glMinmax.3gl.html
glMinmax(3gl) - define minmax table - Linux manual page.....
When GL_MINMAX is enabled, the RGBA components of incoming pixels are compared to the minimum and maximum values for each component, which are stored in the 2-e

manpages/QLength.3.html
QLength(3) - Display macros and functions - Linux 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





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