huayichen / simple

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

WriteString(FileHandle, String) WTF #15

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
Code 
If Exists(Filename) = False Then
   FileHandle =  Open(Filename)
    Close(FileHandle) 
    FileHandle =  Open(Filename)
    WriteString(FileHandle,"Testline 0")
    WriteString(FileHandle,"Testline 1")
    WriteString(FileHandle,"Testline 2")
    WriteString(FileHandle,"Testline 3") 
    WriteString(FileHandle,"Testline 4")
    WriteString(FileHandle,"Testline 5")
    WriteString(FileHandle,"Testline 6")
    WriteString(FileHandle,"Testline 7")
    WriteString(FileHandle,"Testline 8")
    WriteString(FileHandle,"Testline 9")
    WriteString(FileHandle,"Testline 10")
    WriteString(FileHandle,"Testline 11")
    WriteString(FileHandle,"Testline 12")
    WriteString(FileHandle,"Testline 13")
    WriteString(FileHandle,"Testline 14")
    WriteString(FileHandle,"Testline 15")
    WriteString(FileHandle,"Testline 16")
    WriteString(FileHandle,"Testline 17")
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
Testline 8
Testline 9
Testline 10
Testline 11
Testline 12
Testline 13
Testline 14
Testline 15
Testline 16
Testline 17# 

What really happens
# cat testfile.dat

Testline 0
Testline 1
Testline 2
Testline 3
Testline 4
Testline 5
Testline 6
Testline 7
Testline 8
Testline 9
          Testline 10
                     Testline 11
                                Testline 12
                                           Testline 13
                                                      Testline 14
                                                                 Testline 
15

Testline 16

Testline 17# 

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