Hello Experts... I have a routine which would read a "chunk" of bytes from a file using a stream, do a bit of processing, then write that chunk to an output stream.. and repeat this till nothing left to read. Before the read I have these statements:
Chunksize := 2048000;
GetMem(CopyBuffer, ChunkSize); // CopyBuffer is defined as a PChar
And I do the read as such:
At the end when cleaning things up and closing files, I have this statement:
This all used to work fine, until I just added some code that steps through the CopyBuffer a bit, looking for a #13 character:
while CopyBuffer^ <> #13 do
Now when I run it, it crashes on the FreeMem(CopyBuffer, Chunksize); statement giving "Invalid Pointer Operation". Any idea how to remedy this, anyone?