How safe is LoadText for big files?

BlitzMax Forums/BlitzMax Programming/How safe is LoadText for big files?

Grey Alien(Posted 2007) [#1]
I'm wanting to use LoadText to read in a unicode file of game text and in theory that file could get pretty big. Does anyone see any potential problems with just reading it all in as one massive string? Does BMax have any string size limits?

thanks.


HrdNutz(Posted 2007) [#2]
I would think that 64bit (double precision) is the variable limit. But don't trust me on that, because I'm not really sure how LoadText works or how strings work O.O

Now that you asked, would be nice to know as well.


GfK(Posted 2007) [#3]
There is a limit to string size, and although I can't remember exactly what it is, its stupidly big.

Wouldn't you be better off loading it into a bank and parsing it from there?


HrdNutz(Posted 2007) [#4]
Hmm, I guess strings are arrays, so maybe as big as you can make a byte array?


Damien Sturdy(Posted 2007) [#5]
yeah. and with that, comes access to gigabyte-size files. I don't think there will be a problem, other than speed.

Blitz3D seemed to slow down with huge strings, I havent tested in Max. Give it a go :D


Winni(Posted 2007) [#6]
Store the texts in a SQLite database and only load the parts that you need.

By the way, you could also add a language identifier and enable your program to switch the language on the fly.


Grey Alien(Posted 2007) [#7]
Gfk: Banks, yuk! ;-) I used to code with Banks on the Amiga, but I don't view them as very "easy to code" or flexible in terms of OOP. I prefer my memory to be structured.

OK, so people thing it should be fine. Cool.

Winni: At the moment there is a region flag and all the text is preloaded, but I could reload it dynamically easily enough. However, the localised version of the games will have lots of localised graphics too, so we will ship different versions of it rather than pad out the download size with other graphics in.