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.

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

Return Value<br />

ab Append: open or create a binary file for writing at<br />

the end-of-file.<br />

r+ Open text file for updating, reading and writing at<br />

the current file position.<br />

w+ Truncate to zero length or create text file for<br />

updating, reading and writing at the current file<br />

position.<br />

a+ Append: open or create text file for updating,<br />

reading at the current file position and writing at<br />

the end-of-file.<br />

r+b or rb+ Open binary file for updating, reading and writing<br />

at the current file position.<br />

w+b or wb+ Truncate to zero length or create binary file for<br />

updating, reading and writing at the current file<br />

position.<br />

a+b or ab+ Append: open or create a binary file for updating,<br />

reading at current file position and writing at the<br />

end-of-file.<br />

Opening a disk file with read mode (r as the first character in mode<br />

argument) fails if the file does not exist or cannot be read.<br />

Opening a disk file with append mode (a as the first character in<br />

mode argument) causes all subsequent writes to the then current<br />

EOF, regardless of intervening calls to the fseek function.<br />

When a disk file is opened with update mode (+ as the second or<br />

third character in mode argument) both read and write operations<br />

may be performed on the associated stream. However, output may<br />

not be directly followed by input, or vice-versa, without an<br />

interviewing call to the fflush function or to a file positioning<br />

function, via fseek, fsetpos and rewind. The only exception to<br />

the above rule is a read operation that encounters end-of-file.<br />

If the open operation is successful, this function returns a pointer to the FILE<br />

object that must be used in subsequent calls to specify this opened stream. If the<br />

operation fails, a null pointer is returned and errno is set.<br />

3-40 <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!