This function will return the remaining part of the current line, ie. it reads data from the specified buffer starting at the current buffer position (which may be anywhere in the line) and continuing until it finds the next line break (according to the active line endings logic of the buffer) or until the buffer end, if no more line breaks exist. The operation is in that very similar to LINE INPUT when reading from text files.
The current buffer position is updated accordingly and is on the first byte behind the line break (ie. at the start of the next line) after the call. Hence, sequential reading is easily possible with subsequent calls. You may use EndOfBuf() to check, whether the buffer end is reached or not.
SYNTAX:
text$ = ReadBufLine$ (buf$())
INPUTS:
buf$() (STRING array)
- This is the array of any existing and initialized buffer, from which you wanna read.
RESULT:
text$ (STRING)
- The text read from the buffer without the actual line break char(s), similar to LINE INPUT, which returns lines also without the line breaks, when reading from text files.
- Depending on the current buffer position, this must not necessarily be the entire line as it is present in the buffer (see Notes).
- Will be an empty string, if you try to read past the buffer end. However, no error is thrown in such a case.
NOTES:
- To make sure you read a line entirely, you may want to move the current buffer position to the start of line before calling this function, if this is not guaranteed automatically (eg. by reading lines sequentially).
- You may move the current buffer position to the line start using the function SeekBuf() with an displacement of zero (0) and mode SBM_LineStart.