
Click above to get retro games delivered to your door ever month!
X-Hacker.org- FUNCky - <b>name:</b> <b>frewind() - rewind file pointer to previous line of text</b>
[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Name: frewind() - rewind file pointer to previous line of text
Usage: <integer> = frewind(<handle>,[<linelen>])
Params: integer <handle> from a previous fopen() or fcreate()
integer <linelen> - the maximum length of a line if no
newline character is encountered, optional, default
is 512 bytes
Returns: integer equal to the current file pointer position or
-1 if error
The file pointer will be positioned at the start of the
previous line of text.
---------------------------------- Example ---------------------------------
handle = fopen("test.txt)
? freadline(handle) && prints first line
? freadline(handle) && prints second line
? freadline(handle) && prints third line
frewind(handle)
? freadline(handle) && prints third line
frewind(handle)
frewind(handle)
? freadline(handle) && prints second line
frewind(handle)
frewind(handle)
? freadline(handle) && prints first line
Note: The first character of a line of text may be a linefeed
character (chr(10)) on MS DOS based systems. frewind()
and freadline() ignore the line feed character. If the
beginning of the file is encountered, then a 0 offset is
returned and the file pointer is placed on the first
character of the file. If a read error occurs, a -1 is
returned.
The frewind() function will use the character specified
by the _newline() function as a line terminator. See
the documentation on _newline() for more information
See Also: freadline() fwriteline() fbol() fadvance() flocate()
Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson