Topic group Related topics Example
Returns a specified number of characters from a file previously opened with create( ) or open( ).
A reference to the File object that created or opened the file.
The number of characters to return from the specified file.
read( ) returns the number of characters you specify from the file opened by the File object. read( ) starts reading characters from the current file pointer position, leaving the file pointer at the character immediately after the last character read. Use seek( ) to move the file pointer before or after you use read( ).
If the file to be read is a text file, use gets( ) instead. gets( ) looks for end-of-line characters, and returns the contents of the line, without the end-of-line character(s).
To write to a file, use write( ).