quattj
Member
I have a text file that I need to parse. I've been using the file_text_* functions, which are doing what I need. But I also know the buffer* functions are newer/faster. The amount of reading I am doing is not noticeable timewise, so speed doesn't really matter. But I want to do it properly, so, a few questions:
Let's says I have a buffer "XG_ini".
With text functions,
I extract strings and numbers I need from next_line.
However, I'm not sure how to do the same with buffers. I've done binary buffers where I am reading through the entire buffer from start to end, and I know the sizes of all my data beforehand so can select the right size read or buffer spot when needed. I don't know how to do this with a text file, especially when it comes to the EOF marker, and new line/carriage returns.
I tried using XG_ini = buffer_load(etc...
but using
next_line = buffer_read(XG_ini, buffer_string);
or
next_line = buffer_read(XG_ini, buffer_text);
both read the whole entire file in to the string. Super opposite of useful. :/ And doing a byte by byte read would defeat the purpose of using buffers in the first place.
Let's says I have a buffer "XG_ini".
With text functions,
GML:
while (!file_text_eof(XG_ini))
{
next_line = file_text_read_string(XG_ini);
file_text_readln(XG_ini);
}
However, I'm not sure how to do the same with buffers. I've done binary buffers where I am reading through the entire buffer from start to end, and I know the sizes of all my data beforehand so can select the right size read or buffer spot when needed. I don't know how to do this with a text file, especially when it comes to the EOF marker, and new line/carriage returns.
I tried using XG_ini = buffer_load(etc...
but using
next_line = buffer_read(XG_ini, buffer_string);
or
next_line = buffer_read(XG_ini, buffer_text);
both read the whole entire file in to the string. Super opposite of useful. :/ And doing a byte by byte read would defeat the purpose of using buffers in the first place.
Last edited: