;' create a file containing a String
Global f=WriteFile("temp.dat")
WriteCString (f,"This is a test")
CloseFile f
;' Read the file back again
f = ReadFile("temp.dat")
ReadCString(f)
CloseFile f
MouseWait
Function WriteCString(f,txt$)
DebugLog txt$
WriteString (f,txt$)
WriteByte (f,0)
End Function
Function ReadCString(f)
Repeat
b=ReadByte(f)
DebugLog b
If b<>0;Null
txt$=txt$+Chr(b)
EndIf
Until b=0
Print Chr(txt$)
End Function
i know i can do readstring(file) and writestring(file,string)i am trying to find a way to read a null terminated c string into blitz, and read strings doesn't seem to work.....any ideas...
|