TSAVE
TSAVE file, var
Writes the array or string var
to the text file
file
. Each array element is a text-line in the file. Every
line of the string will be one line in the text file. Use
\n
in the string to separate lines.
See TLOAD for loading data from a text-file.
Example 1: Save an array
' Create an array with some data
1
A << "test"
A << 2
A << print A ' Output: [1,test,2]
' Save the array. This will create the file myfile.txt in
' the same directory as your BASIC file
tsave "myfile.txt", A
' Load the file
tload "myfile.txt", B
print B ' Output: [1,test,2,]
Example 2: Save a string
' Create a string with some data
"line 1\nline 2\nline 3"
A = print A ' Output: line 1
' line 2
' line 3
' Save the string. This will create the file myfile.txt in
' the same directory as your BASIC file
tsave "myfile.txt", A
' Load the file
tload "myfile.txt", B
print B ' Output: [line 1,line 2,line 3]
Code samples using TSAVE
File
ACCESS
BGETC
BLOAD
BPUTC
BSAVE
CHDIR
CHMOD
CLOSE
COPY
DIRWALK
EOF
EXIST
FILES
FREEFILE
INPUT
INPUT
KILL
LOCK
LOF
MKDIR
OPEN
READ
RENAME
RMDIR
SEEK
SEEK
TLOAD
TSAVE
WRITE
If there is insufficient information on this page and you wish learn more about TSAVE,
please send an email to smallbasic@gmail.com. You can help to improve information about
TSAVE by submitting a pull request,
click View Source for details. Note, an offline language reference text file is also available - see the Download section.