I've had a few cases when I had to read/write a stream (specifically TMemoryStream) and sync it with a string. However, every time I've tried, I failed. The little sample code I've found is also not telling the whole story and such. One main problem is when I need to clear the data in the stream and re-use it for something else. Sometimes I have strange exceptions when trying to free a memory stream.
What's the best and most recommended method for translating a stream to and from a string? In the end it will consist of using TBitmap.SaveToStream(MyStream) and TJDClientSocket.Socket.SendStream(MyStream)...
Each of these streams may be re-used without freeing, but that's where I seem to have the problems, when I clear the data and add new data. I know my current project will require me to do this, so I need to get it down.
I'll probably wind up wrapping it into some class like TStringStream and provide string routines to read/write with the stream.
JD Solutions
What's the best and most recommended method for translating a stream to and from a string? In the end it will consist of using TBitmap.SaveToStream(MyStream) and TJDClientSocket.Socket.SendStream(MyStream)...
Each of these streams may be re-used without freeing, but that's where I seem to have the problems, when I clear the data and add new data. I know my current project will require me to do this, so I need to get it down.
I'll probably wind up wrapping it into some class like TStringStream and provide string routines to read/write with the stream.
JD Solutions