CreateRamStream ?

BlitzMax Forums/BlitzMax Programming/CreateRamStream ?

Strict

Global myRam : Byte Ptr = MemAlloc(128) 'allocate 128 bytes of memory to myRam

Global myStream : TRamStream = CreateRamStream(myRam, 128, True, True) 'Create a ram stream and link it to myRam

WriteLine(myStream, "test text") 'write the text
SeekStream(myStream, 0) 'reset the stream to the beginning
Print ReadLine(myStream)'read the text and print it

myStream = Null
MemFree(myRam, 128) 'clear the alloced memory

End