Fread

Fread

fread is a function that reads buffered binary input from a file. It is included from the stdio.h header file in the standard C library.

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

The fread function copies nmemb items of data of size size from the named input stream into an array pointed to by ptr. An item of data is a sequence of bytes (not necessarily terminated by a null byte) of length size. fread stops appending bytes when nmemb items have been read, end of file has been reached, or an error has occurred. Upon returning, fread sets the file pointer in the stream pointing to the byte past the last byte that has been read. The contents of stream remain unchanged. The fread function returns the number of items actually read. If nmemb is zero, no action is taken and the function will return 0.

Diagnostics

The function may fail with the following error codes:
* EAGAIN - Cannot read the input stream immediately without blocking the process, and the O_NONBLOCK flag is set for the file descriptor associated with stream.
* EBADF - Not a valid file descriptor open for reading.
* EINTR - The read operation was terminated by a signal before any data was read.
* EIO - Cannot read from the controlling terminal. This happens when the process is in a background process group and the attempt by the process to read from its controlling terminal fails, either because the process group is orphaned, or because the process is ignoring or blocking the SIGTTIN signal.
* ENOMEM - Insufficient storage space is available.
* ENXIO - Attempt to read from a non-existent device, or from a device whose capabilities are exceeded.

References

*http://docsrv.sco.com:507/en/man/html.S/fread.S.html


Wikimedia Foundation. 2010.

Игры ⚽ Поможем сделать НИР

Look at other dictionaries:

  • fread — est une fonction qui lit l entrée de la mémoire tampon d un fichier. Elle est incluse dans l en tête stdio.h de la bibliothèque standard de C. size t fread (void * restrict ptr, size t size, size t nmemb, FILE * restrict stream) La fonction fread …   Wikipédia en Français

  • Obfuscated code — Obfuscated code is source or machine code that has been made difficult to understand for humans. Programmers may deliberately obfuscate code to conceal its purpose (security through obscurity) or its logic to prevent… …   Wikipedia

  • Differential execution — refers to a method of executing a computer subroutine (See control flow) in such a way that differences from prior executions can be detected and acted upon. If the subroutine is one that walks through a data structure, differential execution can …   Wikipedia

  • Example Pictor Decoder — Pictor PCPaint PIC image format PICtor is an image file format developed by John Bridges, the principal author of PCPaint, the first Paintbrush program for the PC. It was also the native file format for Pictor Paint and GRASP (multimedia… …   Wikipedia

  • Файловый ввод/вывод в языке Си — Язык программирования Си поддерживает множество функций стандартных библиотек для файлового ввода и вывода. Эти функции составляют основу заголовочного файла стандартной библиотеки языка Си <потоками байтов, которые могут быть как потоками… …   Википедия

  • Ontario Central Airlines — Nunasi Central Airlines IATA ICAO NUN Callsign NUNASI Founded 1947 Operating bases Kenora Airport Fleet size …   Wikipedia

  • C file input/output — C Standard Library Data types Character classification Strings Mathematics File input/output Date/time Localiza …   Wikipedia

  • Alfred M. Pride — Infobox Military Person name= Alfred Melville Pride caption= Alfred M. Pride born= September 1897 died= December 24 death year and age|1988|1897 placeofbirth= Somerville, Massachusetts placeofdeath= Arnold, Maryland placeofburial= Arlington… …   Wikipedia

  • Princeton High School (Sharonville, Ohio) — Princeton High School is a public, co educational comprehensive high school located in Sharonville, Ohio.PHS serves grades nine through twelve. Established in 1959 and having graduated its first class in 1963, Princeton High School is located… …   Wikipedia

  • Florence M. Read — was president of Spelman College from 1927 1953. Read received her B.A. from Mount Holyoke College in 1909 and served as alumnae secretary. She taught at Reed College and was also college secretary. Prior to joining Spelman, she was Executive… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”