I have a program I am working on that requires a few very large arrays to be set up on start up as look up tables. The amount of data in each of them is anything up to 200,000 entries.
I have the entries in a text document ready to paste into a DIMDATA line but it looks like GLBasic can't handle really really long line in the editor and just locks up when I paste the data in
Is there any other solution to my problem without having to resort to reading in the data from a file at start up and also can GLB handle arrays of that size?
Thanks
Gary
You can't just read them as data from the txt file directly?
would rather have them hidden away from prying eyes and being accidentally deleted or edited but will go for the load option if thats the only way
trying to set them up via the data file but seem to be having issues opening the file
my code is
OPENFILE(1,"47.txt",1)
FOR a = 0 TO 40
READLONG 1,temp%
win47[a] = temp%
NEXT
CLOSEFILE 1
to open and read the file attached which was generated by another GLB program to contain 40 longs but I am getting a error of No File. The file is in the right directory and exists so at a bit of a loss where I'm going wrong
You would end up using double memory using large data which is not designed in that way. Large data is also better from data files really. You can also crypt or hash them eventually.
I'm normally use READLINE using a string and then pass to a variable.
Yep. READLINE from a .txt file into an array is how I'd do it too.
You could encode them onto a bitmap and then just read it in, then decode the bitmap a rgba pixels as a 32bit number. This would be quite fast a reading it in and double as a simple encryption. Just an idea.
Gary, to check if the file exists in your current directory, use (copied from the GLBasic User Manual):
ok=DOESFILEEXIST("test.txt")
IF ok
PRINT "Test.txt exists", 100, 100
ELSE
PRINT "Test.txt does not exist", 100, 100
ENDIF
You may not be reading from the directory you think you are.
Try specifying an absolute path for testing.
Or use the GETCURRENTDIR$() to see which one you're in.
I'm did the bitmap thing for a H.E.R.O in the past :-).
The main issue can been lost of depth with 16bit graphics, which can cause imprecise, which I'm also seen that in that game. So it's does have issues on its own.
But using data with large data is nowhere good idea.
Write the data to a cache file in binary format, maybe?
Gesendet von meinem GT-N7100 mit Tapatalk