This subroutine will write the given text into the specified buffer starting at the current buffer position and will automatically add the line break char(s) (according to the active line endings logic of the buffer). The operation is in that very similar to PRINT when writing to text files.
The call will also recalculate all markers to maintain its respective positions. The current buffer position is updated accordingly and is on the first byte behind the just written line break (ie. at the start of the next line) after the call. Hence, sequential writing is easily possible with subsequent calls.
SYNTAX:
WriteBufLine buf$(), text$
INPUTS:
buf$() (STRING array)
- This is the array of any existing and initialized buffer, to which you wanna write to.
text$ (STRING)
- The text line to write into the buffer without any line break char(s), hence just as you'd give it to PRINT, when writing into text files.
NOTES:
- Depending on the current buffer position, your write may go into the middle of another text line and split that line up.
- To make sure you write a new line entirely before or after the current line, you may want to move the current buffer position either to the start of the current line or the start of the next line before calling this subroutine, if this is not guaranteed automatically (eg. by writing lines sequentially).
- You may move the current buffer position to the current line's start using the function SeekBuf() with an displacement of zero (0) and mode SBM_LineStart.
- To move to the next line's start use LEN(BufEolSeq$()) as displacement and mode SBM_LineEnd instead.