06.08.2013 Views

pSOSystem System Calls - Read

pSOSystem System Calls - Read

pSOSystem System Calls - Read

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

pREPC+ <strong>System</strong> <strong>Calls</strong> fread<br />

fread <strong>Read</strong>s from a stream.<br />

#include <br />

#include <br />

size_t fread(<br />

void *ptr, /* buffer */<br />

size_t size, /* element size */<br />

size_t nmemb, /* element count */<br />

FILE *stream /* stream pointer */<br />

)<br />

Description<br />

Arguments<br />

Return Value<br />

Error Codes<br />

This function reads up to nmemb elements whose size is specified by size from the<br />

stream pointed to by stream and puts them into the user buffer pointed to by ptr.<br />

The file position indicator for the stream (if defined) is advanced by the number of<br />

characters successfully read. If an error occurs, the resulting value of stream’s file<br />

position indicator is indeterminate. If a partial item is read, its value is<br />

indeterminate.<br />

ptr Points to the user buffer where items are stored.<br />

size Specifies the size of each item.<br />

nmemb Specifies the number of items to read.<br />

stream Points to an open pREPC+ stream.<br />

This function returns a count of the number of items successfully read. If an error<br />

occurs, stream’s error indicator and errno are set. If size or nmemb is zero,<br />

fread() returns 0 and the contents of the array and the state of the stream remain<br />

unchanged.<br />

Refer to Appendix B.<br />

<strong>pSO<strong>System</strong></strong> <strong>System</strong> <strong>Calls</strong> 3-51<br />

3

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!