Hi
After I open a file and create the first record, then second record my
program crashes on the third record. Hope someone can help out.
Thanks
' --------------------------------------------------
What is the expected output? What do you see instead?
First time through
-- Create a file if not exist.
-- Then write string to it.
Remaining times trough
--- Open the created file
--- Go the the top of file
--- Count the string
--- move file pointer to last record
--- Write new string
What version of the product are you using? On what operating system?
Simple-linux-0.1.1
Please provide any additional information below.
Here is my code
'------ Save the data to a file
Sub SaveData()
Dim Filename As String
Dim FileHandle As Integer
Dim Filepointer As Integer
Dim counter As Integer
Filename = "test.dat"
If Exists(Filename) = False Then
FileHandle = Open(Filename)
WriteString(FileHandle,StringRecord)
ElseIf Exists(Filename) = True Then
FileHandle = Open(Filename)
Seek(FileHandle,0)
counter = 0
Do
ReadString(FileHandle)
counter = counter + 1
While Eof(FileHandle) = False
Seek(FileHandle,counter)
WriteString(FileHandle,StringRecord)
End If
Close(FileHandle)
Result1.Text = "Data Saved"
End Sub
----------------------
My code to read from the file is below
Sub GetSavedHistoryData()
Dim Filename As String
Dim FileHandle As Integer
Dim ResultBack As String
Filename = "test.dat"
If Exists(Filename) = True Then
FileHandle = Open(Filename)
Seek(FileHandle,0)
Counter = 0
Do
ResultBack = ReadString(FileHandle)
Data1.Row = Counter
Data1.Text = ResultBack
Counter = Counter + 1
While Eof(FileHandle) = False
Close(FileHandle)
Else
Exit
End If
End Sub
Original issue reported on code.google.com by BobPer...@gmail.com on 1 Feb 2010 at 11:28
Original issue reported on code.google.com by
BobPer...@gmail.com
on 1 Feb 2010 at 11:28