OK..First, I know I posted how to do this somewhere in these forums a very long time ago, because I used this with my Throwman game. I'm confused!
I used it to save passwords, game stats and scores, and lines of text.
It is very very simple to use.
NOTE: I'm going to add a tutorial on this in issue 15 of bbb.
- Code: Select all
Sub Write2File(yourfilename, byval savetext)
dim myfile
set filesys = CreateObject ("Scripting.FileSystemObject")
set myfile = filesys.CreateTextFile (GetPath(2) & yourfilename, true)
set myfile = filesys.GetFile(GetPath(2) & yourfilename)
set txtstream = myfile.OpenAsTextStream (2, -2)
txtstream.Write savetext
txtstream.Close
End Sub
- Code: Select all
Function GetAllFileContents(yourfilename)
Dim mytext
Dim myfile
set filesys = CreateObject ("Scripting.FileSystemObject")
set myfile = filesys.GetFile(GetPath(2) & yourfilename)
set txtstream = myfile.OpenAsTextStream (1, -2)
mytext = txtstream.readall()
txtstream.Close
GetAllFileContents = mytext
End Function