if the file is not visible after you thought it has to be...but the file is visible after shutdown the program, this has to do with a never processed CloseFile() command. At the end of program, B3D closes all open streams. (...all files YOU missed to close...). This means your code never did it!
Or the Closefile()-command is not corresponding to the stream any more....Perhaps, because the stream ID has changed?
for test purposes try to define your stream-variable GLOBAL. try to comment all OpenFile(), Writexxx() and CloseFile() commands with a DEBUGLOG and see in the debugger, whether the sequence of commands was as you expected. You should see a sequence of opening, writing and closing with always the same ID:
GLOBAL Stream
....
Function blabla()
....
Stream=OpenFile
DEBUGLOG "Open Stream ID=" + Stream
....
End Function
Function WriteSomething_blabla()
.....
WriteLine Stream, "Hello"
DEBUGLOG "Write to Stream ID=" + Stream + " Line=" + "Hello"
....
WriteByte Stream, Value
DEBUGLOG "Write to Stream ID=" + Stream + " Byte=" + Value
....
End Function
Function Final_blabla()
CloseFile Stream
DEBUGLOG "Close Stream ID=" + Stream
End Function
The main reason, why I sometimes got this behavior, was an EXIt or RETURN command before the Closefile(). Search in your code for lines like this:
Function Save()
Stream=Openfile("...")
For i=0 to Max
WriteLine Stream , Text[i]
If Text[i]="" Then RETURN
Next
CloseFile Stream
End Function
There is a big difference between "file not on disk" and "incomplete". If the file is incomplete, it could be caused by a value in the file, which the text editor could not understand, f.e. a Byte with the value of Zero causes the text editor the continue reading...
We need more information about what you are writing on the disk (text, Bytes, ...) and you really should send some code example...for time reasons :-)
Last edited 2011
|