File object methods

Hello!
I'm currently converting a BGT project to NVGT and have two questions about the file object.
First, is there a substitute for the read_until method that was available in BGT?
Second, is there a substitute for the reached_end boolian?
I'm looking forward to your replies.
Regards
Taurus Fan

  1. I don't think read_until method is available yet. There is a parameter to read the number of bytes or characters, or 0 to read the entire contents which is default. However it doesn't seem to provide what you need.
  2. The property to check if the file reaches end, it's called eof, which is available on all datastreams.
1 Like

Thanks a lot, the eof method works just fine.

So file.read_until is more obscure and I tend to forget we don't have this, now that it came up again I started coding it, and since I have the file opened am hopeful to have it committed by the end of the day. Sorry for the missing method!

OK, file.read_until, or at least a rough draft of it, has been added in NVGT's latest commit. Either you can rebuild it from source or it will appear in the next version.

1 Like

Thanks for the information, I appreciate it.

It is worth noting that the eof property (which if I'm not mistaken is an internal call to std::basic_ios::eof has some... Weird quirks. I'm hoping they don't manifest on the NVGT side, but if they do, the way you'd read from a stream until the end is something like (untested):

while ((stream >> var)) { ... }

But hopefully this kind of reading isn't necessary.