roadlabs / simple

Automatically exported from code.google.com/p/simple
0 stars 0 forks source link

Seek (filehandle,offset) not working correctly, Cannot append to file #14

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Follow this code
---------------------------------
Dim Filename As String 
Filename = "testfile.dat"

If Exists(Filename) = False Then
   FileHandle =  Open(Filename)  
    WriteString(FileHandle,"Testline 0")
    WriteString(FileHandle,"Testline 1")
    WriteString(FileHandle,"Testline 2")
    WriteString(FileHandle,"Testline 3") 
    Close(FileHandle)

    FileHandle =  Open(Filename) 
    Seek(FileHandle,3)
    WriteString(FileHandle,"Testline 4")
    WriteString(FileHandle,"Testline 5")
    WriteString(FileHandle,"Testline 6")
    WriteString(FileHandle,"Testline 7")
 Close(FileHandle)
End If 

----------------------------------------------------
What is the expected output? What do you see instead?

# cat testfile.dat
Testline 0
Testline 1
Testline 2
Testline 3
Testline 4
Testline 5
Testline 6
Testline 7
# 

Actual Results: 

# cat testfile.dat

T
Testline 4
Testline 5
Testline 6
Testline 7# 

Original issue reported on code.google.com by BobPer...@gmail.com on 2 Feb 2010 at 9:02