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.

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

freopen Reopens a file.<br />

#include <br />

#include <br />

FILE *freopen(<br />

const char *filename, /* filename */<br />

const char *mode, /* access mode */<br />

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

)<br />

Description<br />

Arguments<br />

Return Value<br />

Error Codes<br />

The freopen() function first closes the file specified by stream. Then it opens the<br />

file named by the string pointed to by filename and associates it with the stream<br />

pointed to by stream. The file is opened in the mode specified by mode, which is<br />

interpreted just as in fopen. The error and end-of-file indicators for the stream are<br />

cleared.<br />

If the close operation fails, filename is still opened and attached to stream.<br />

This call can be used to rename stdin, stdout, and stderr.<br />

filename Points to the name of the file to be opened.<br />

mode Points to the mode string, which specifies how to open the<br />

file.<br />

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

This function returns a file pointer if the file specified by filename is opened, or it<br />

returns a null pointer if it does not open the file. If an error occurs, errno is set.<br />

Refer to Appendix B.<br />

3-54 <strong>pSO<strong>System</strong></strong> <strong>System</strong> <strong>Calls</strong>

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

Saved successfully!

Ooh no, something went wrong!