Searching for a way of storing a variable number of different array (both strings & UDTs) and a couple of non-array UDTs, I have loaded each row of each array into a string (not asciz) , preceded by an identifying character. The file resulting from this looks convincing.
Reloading the file looks like this:
and it does just what I wanted, except that everything is offset "left" by one byte, so that a string member of a UDT array will have a leading zero byte, for example.
Where am I going wrong?
Reloading the file looks like this:
Code:
hfile = FREEFILE OPEN sAppName FOR BINARY AS #hfile FILESCAN #hfile, RECORDS TO nrecs DIM sTemp(0 TO nrecs - 1) ' sTemp is a string array GET #hfile, 1, sTemp() CLOSE #hfile DIM gCA(%lotsandlots) AS GLOBAL tCPH DIM gEB(%lotsandlots) AS GLOBAL STRING FOR i = 0 TO UBOUND(sTemp) SELECT CASE LEFT$(sTemp(i),1) CASE "F" POKE$ VARPTR(Fstuff), MID$(sTemp(i),1) ' Fstuff is a UDT CASE "C" POKE$ VARPTR(gCA(lcx)), MID$(sTemp(i),1) INCR lcx CASE "E" gEB(lex) = MID$(sTemp(i),1) INCR lex END SELECT NEXT REDIM PRESERVE gCA( 0 TO lcx) AS GLOBAL tCPH REDIM PRESERVE gEB( 0 TO lex) AS GLOBAL STRING
Where am I going wrong?
Comment