I have a DLL that transfers data to a stream. But it adds a postfix and a prefix that I don't want. I can create a MemoryStream, let the DLL output the data, and then trim it, but there can be several GB of data, so I just want it to be saved directly to a file (FileStream). I believe the best solution is to create your own Stream class. So I did:
function TFileStream2.Write(const Buffer; Count: Integer): Longint;
where I check the position, and if it = 0, I drop the first few bytes from the buffer. That way I can trim the beginning of the file. But how can I detect the end of a stream so that I can discard some bytes from the end?
source
share