Its a bit late - so if this doesn't work don't kill me, but
here it goes :
Q1 := TFileStream.Create(curDir + 'Qtop.doc',fmOpenRead or
fmShareDenyWrite);
Q2 := TFileStream.Create(curDir + 'Qbody.doc',fmOpenRead or fmShareDenyWrite); Q3 := TFileStream.Create(curDir + 'Qdone.doc',fmCreate or
fmShareDenyWrite);
Q3.CopyFrom( Q2, 0 );
Q3.Free;
Q2.Free;
Q1.Free;
Ie, you are saying to Q3, copy the contents of the stream in
the parameter. The second parameter - 0 - says that the stream you are
copying from should have its position reset before the copy, and the entire
stream should be read.
Your code copies Q3 into a TFileStream instance with no
Reference Variable. Since Q3 hasn't been created this could be a problem
:-)
You can also use TMemoryStream to load into - ie make Q3 a
memorystream, and then use the TmemoryStream SaveToFile method after you have
streamed in the data from the other two files using. Don't use the
loadfromfile method however because it empties the receiving stream, and
therefore two copies won't work.
|
- [DUG]: HELPPPPPPPP !!!!! richter
- Re: [DUG]: HELPPPPPPPP !!!!! Brett Lin
- [DUG]: Newbie Question re TFileStream Tony Arcus
- Re: [DUG]: Newbie Question re TFileSt... Peter Harrison
- Re: [DUG]: Newbie Question re TFileSt... Aaron Scott-Boddendijk
- Re: [DUG]: HELPPPPPPPP !!!!! Mike Osborne