ReadString problem?

BlitzMax Forums/BlitzMax Beginners Area/ReadString problem?

Right, well i have some files i made in blitz+, and alot of the data in them used the old writestring command, what im wondering is how i would read them this time with the new ReadString seeing as that one now has a length command?

[EDIT: don't do it this way - I thought you meant ReadLine() ]
Perhaps, read the whole file into the string (using the length of the file), and then break it up from there.

Function RetroReadString:String(Stream:TStream)
	Local strLen:Int = Readint(Stream)
	Return ReadString(Stream, strLen)
End Function


myStream : TStream = OpenFile("c:\testread.txt")

Print RetroReadString(myStream)

CloseFile(myStream)

End


i dont know if this is what your looking

'Load SourceFile

sourcefile$=Input("SourceCode:")
source = OpenFile(sourcefile$,True,True)

'Create TList

bmx:TList=CreateList()

find$="TList"

Repeat
'Read File Then Put Code Into Tlist

code$=ReadLine(source)
Print code$
ListAddLast bmx,code$

output=WriteStream("output.txt")

'Find Each Line In A Tlist Then Export New SourceFile

For a$=EachIn bmx
WriteLine output, a$
Next

Until Eof(source)


Thanks guys ^_^, ill check them out!

I don't have B+ btw, but I do have B3D, I am assuming that they write strings in the same way (Int size then characters)

Yep it works, THanks ^_^