I've been using version 6.248 of GL Basic for the longest time and didn't really need to upgrade it since it has worked fine with everything I threw at it. Well, I come to the point where I needed to do some extensive work with files and started using openfile() and it's related functions. What I found is that some of the READ functions work and some fail as in the compiled app just closes as soon as it starts. A similar close as if you referenced an array with an index that is out of it's bounds though that's just an example to maybe narrow down the issue at hand. It could just be something I'm over looking. Anyway, I decided to install the latest version 8.148 in hopes that it would be a bug that got fixed since the last version I was using but this also had the same behavior. A search brought up a few topics on the matter but they didn't bare any fruit.
Below is some sample code I wrote for this issue and it lists the commands that work and the ones that exhibit the problem. I did not test any of the WRITE commands yet though except WRITEUBYTE and it is working correctly. I mainly need to use the LONG versions of the functions. The test file I used is not included, it was only 2k containing some random text.
Below is some sample code I wrote for this issue and it lists the commands that work and the ones that exhibit the problem. I did not test any of the WRITE commands yet though except WRITEUBYTE and it is working correctly. I mainly need to use the LONG versions of the functions. The test file I used is not included, it was only 2k containing some random text.
Code (glbasic) Select
GLOBAL storage%[]; DIM storage[1]
GLOBAL storageieee
GLOBAL storage$
GLOBAL pos = 0
IF OPENFILE(1,"test.txt",1)
WHILE ENDOFFILE(1) = 0
// Not working
READLONG 1,storage[pos]
//READULONG 1,storage[pos]
//READSHORTIEEE 1,storageieee
//READIEEE 1,storageieee
//READSTR 1,storage$,4
// Working
//READBYTE 1,storage[pos]
//READUBYTE 1,storage[pos]
//READWORD 1,storage[pos]
//READUWORD 1,storage[pos]
//READLINE 1,storage$
WEND
CLOSEFILE 1
ENDIF
WHILE TRUE
PRINT "Test: " + storage[pos],0,0
PRINT "Test: " + storage$,0,10
SHOWSCREEN
WEND