Example: fopenInput-Output Functions

Opens a file for buffered I/0.

long fopen( const char *filename, const char *access_mode);

filename The name of the file to open.
access_mode The type of access mode: r, w, a or r+, w+, a+, where the "+" sign indicates that the file must already exist.

The fopen access_mode parameter serves also to specify whether we want to open the file as text or binary, adding t or b characters to this access mode string.

tText mode. In text mode the end of file is assumed to be at first Ctrl+Z character. Some conversions can occur reading and writing with End Of Line / Feedback characters depending on your compiler and your Operating System.
bBinary mode. End of file is reached at last byte of the file. No conversions.

Return Values

If the file has been successfully opened the function will return a pointer to the file. Otherwise it returns a NULL pointer.