Hi!
Short form: Is it possible to create a stream from a pointer?
I have a pointer which points to file data I need to read. I used WriteBuffer() to transfer data from the pointer to a TFileStream, which works. But now I want to read it block wise to display a progress bar. So I need to read it step by step.
I have to options:
1) Increment the pointer Buff, and use WriteBuffer() as usual. (WriteBuffer always reads from the beginning, therefore I need to increment the pointer)
2) Create a Stream from the pointer. Is this possible?
Code:
var InputStream : TMemoryStream;
Buff: Pointer;
Header: TOCHeader;
begin
// Here I get the pointer
Size := GetOverlay(Buff);
// Transfer data to memory stream
InputStream.WriteBuffer(Buff^, SizeOf(Header));
InputStream.Seek(0, soFromBeginning);
// Read the header
InputStream.ReadBuffer(Header, SizeOf(Header));
// Increment the pointer. Doesn't work :-(. Message Ordinal type required
Inc(Buff, SizeOf(TOC));