a***@aol.com
2012-08-12 18:41:13 UTC
I want to delete a section in the middle of a MemoryStream, can I use
CopyFrom for this purpose as :
// Delete 218 bytes from MemoryStream
MemoryStream.Seek(MemDeleteStart + 218, soFromBeginning);
CopyStream := TMemoryStream.Create;
MemStrmSize := MemoryStream.Size;
BytesToCopy := MemoryStream.Size - (MemDeleteStart + 218)
CopyStream.CopyFrom(MemoryStream, BytesToCopy);
MemoryStream.Seek(MemDeleteStart, soFromBeginning);
MemoryStream.CopyFrom(CopyStream, 0);
MemoryStream.SetSize(MemStrmSize - 218);
CopyStream.Free;
. . . or is there a better way to do this ?
Alan Lloyd
CopyFrom for this purpose as :
// Delete 218 bytes from MemoryStream
MemoryStream.Seek(MemDeleteStart + 218, soFromBeginning);
CopyStream := TMemoryStream.Create;
MemStrmSize := MemoryStream.Size;
BytesToCopy := MemoryStream.Size - (MemDeleteStart + 218)
CopyStream.CopyFrom(MemoryStream, BytesToCopy);
MemoryStream.Seek(MemDeleteStart, soFromBeginning);
MemoryStream.CopyFrom(CopyStream, 0);
MemoryStream.SetSize(MemStrmSize - 218);
CopyStream.Free;
. . . or is there a better way to do this ?
Alan Lloyd