StrToFile(FileName$, String$, Append, LineFeed)
Description
Saves or appends the specified String$ to the specified file. Returns 1 if successful, 0 otherwise.
If Append is True (or 1) and the specified file does not exist, a new file is created.
If Append is True (or 1) and the specified file exist, the String$ will append right after last character in the specified file.
If LineFeed and Append are True (or 1), then the specified string will append on next line.
If LineFeed and Append are False (or 0), then the specified string will saved in new file or overwrite the existing one.
Code Examples
file$='c:\temp\test.txt'
string$= 'this string will be append to text file'
ReturnVal=StrToFile(file$,string$,TRUE,FALSE)
This save string$ to test.txt
file$='c:\temp\test.txt'
For i=1 To 10
string$= 'Line ' + CHAR(i)
ReturnVal=StrToFile(file$,string$,TRUE,TRUE)
Next i
This save 10 lines (Line 1...Line 10) to test.txt