How to read an entire file into a string variable?

Blitz3D Forums/Blitz3D Beginners Area/How to read an entire file into a string variable?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Here's a trick that just occurred to me.

WriteString writes an integer, the length of the string, followed by the string data.
ReadString reads this back into a Blitz string.

So you could use Blitz to build a new file consisting of an integer ( the length of the original file ) followed by the original file.

Then use ReadString on this new file.