ChrisBerry
asked on
Blob Fields and BlockWrite/Read
Hi,
I am trying to write (and read) the contents of a blob field to a file using BlockWrite.
I am trying to use the following code but it always gives me an I/O Error 87 - what ever that is, errors being documented the way they are.
ImageStream := TBlobStream.Create(FieldBy Name('Imag e') as TBlobField,
bmRead);
Blockwrite(TXMessageFile, ImageStream, ImageStream.Size);
Any ideas?
Thanks
Chris
I am trying to write (and read) the contents of a blob field to a file using BlockWrite.
I am trying to use the following code but it always gives me an I/O Error 87 - what ever that is, errors being documented the way they are.
ImageStream := TBlobStream.Create(FieldBy
bmRead);
Blockwrite(TXMessageFile, ImageStream, ImageStream.Size);
Any ideas?
Thanks
Chris
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks,
The reason I am using BlockWrite is because this bit is only part of a file I am creating.
I knew I needed a buffer but could not figure out the details.
Thanks again.
Chris
The reason I am using BlockWrite is because this bit is only part of a file I am creating.
I knew I needed a buffer but could not figure out the details.
Thanks again.
Chris
Hi, Chris
> The reason I am using BlockWrite is because this bit is only part of a file I am creating.
It is not problem. You can use TFileStream for work with
part of file as well as BlockWrite/BlockRead.
Vladika.
> The reason I am using BlockWrite is because this bit is only part of a file I am creating.
It is not problem. You can use TFileStream for work with
part of file as well as BlockWrite/BlockRead.
Vladika.
ASKER
Hi Vladika,
>It is not problem. You can use TFileStream for work with
>part of file as well as BlockWrite/BlockRead.
By this do you mean using TFileStream or using 'SaveToFile' method?
I thought 'SaveToFile' always re-wrote the file.
Chris
>It is not problem. You can use TFileStream for work with
>part of file as well as BlockWrite/BlockRead.
By this do you mean using TFileStream or using 'SaveToFile' method?
I thought 'SaveToFile' always re-wrote the file.
Chris
Hi Chris
You are right. I mean TFileStream of course.
I intend you may use TFileStream instead of conventional file I/O
Vladika
You are right. I mean TFileStream of course.
I intend you may use TFileStream instead of conventional file I/O
Vladika
Bought this Q
var Buffer: Pointer;
MemStream: TMemoryStream;
.............
MemStream := TMemoryStream.Create;
try
TBlobField(DataSet.FieldBy
Buffer := MemStream.Memory;
Blockwrite(TXMessageFile, Buffer^, MemStream.Size);
// use Buffer^ !!!! Stream is not buffer
finally
MemStream.Free;
end;