Covert a String to a TextStream?

BlitzMax Forums/BlitzMax Programming/Covert a String to a TextStream?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

A RAM Stream points directly to a buffer/string. This is faster than the option above since there's no copying involved.

Local str:String
Local stream:TStream

str = "this is a test"
stream = CreateRamStream(str, str.length, True, False)

Print stream.ReadString(5)


But careful with that, writing beyond the length of the stream will cause problems.