HOWTO: Save list of strings as DAT FILE , and read back as strings.
Root / Programming Questions / [.]
CoinzReturnsCreated:
DEF ENCODE INPUTSTRING$ ARRAYPOINTERINDEX for t=0 to len(INPUTSTRING$) currentchar$ = mid$(INPUTSTRING$, T, 1) TRANSLATETOVALUE CURRENTCHAR$ OUT VALUE arr[ARRAYPOINTERINDEX+t] = VALUE next ENDThis is the first function you will need. Explanation: You would call ENCODE, and give it the input string, and it would automatically put the values (related to each character in the string) into an array. The function TRANSLATETOVAL is still needed. here' s a pre-requisite.
'Store 0-9 as numbers in numeric ALPHNUMERIC$[37] for t=0 to 9 ALPHANUMERIC$[t] = str$(t) next t DIM ALPHABET$[27] 'THIS PUTS THE DATA INTO ALPHABET for t=0 to 26 read letter$ ALPHABET$[t]=letter$ next t FOR T=0 TO 27 LETTER$ = ALPHABET$[T] ALPHANUMERIC$[T+10]=LETTER$ NEXT T 'OK NOW EVERY SINGLE LAST VALUE IS ACTUALLY STORED FROM 0-9 AND FROM A-Z AS A 'SINGLE CHARACTER IN THESE ARRAYS. 'WE CAN NOW CHECK AGAINT THEM AND USE T AS THE ENCODER VALUE DATA "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"So now that this is all set up you will want the getvalue function
DEF TRANSLATETOVALUE CURRENTCHAR$ OUT VALUE FOR T=0 TO LEN(ALPHANUMERIC) LETTER$ = ALPHANUMERIC$[T] IF CURRENTCHAR$==LETTER$ THEN VALUE = T BREAK ENDIF NEXT T ENDputting all of this together along with this at the start of your code
DIM ARR[250] 'SHOULD BE ENOUGH FOR NOW INCREASE IF NOT ARRAYPOINTERINDEX=0 'THIS SHOULD ALWAYS BE INCREASED AFTER ENCODING 'BY INCREASING IT'S VALUE BY ITSELF + THE LENGTH OF THE STRING TO BE ENCODED!and those are the basic concepts.. you would just write the opposite thing to get the values back.. i'll show how later and lastly you would just save the array Arr[] as a dat file.