Board index » delphi » Writing Strings, Integer, Bitmaps to a single file

Writing Strings, Integer, Bitmaps to a single file

Hello,

i have a problem writing strings, integers, bitmaps to my TFileStream.
what i did was first to write some strings, then integers, and lastly
a bitmap using

    fs.WriteBuffer(bmpStrecke,sizeOf(bmpStrecke));

bmpStrecke is my bitmap of type TBitmap that i want to write to the
filestream. what happens is that my strings and integer values are
written perfectly, however, when i try to read the bitmap, it's empty.
how do i get my bitmap into my file? any help is appreciated.

Greetings, Chris

 

Re:Writing Strings, Integer, Bitmaps to a single file


Quote
"Chris" <kil...@bigfoot.de> wrote in message
>     fs.WriteBuffer(bmpStrecke,sizeOf(bmpStrecke));

> bmpStrecke is my bitmap of type TBitmap that i want to write to the
> filestream. what happens is that my strings and integer values are
> written perfectly, however, when i try to read the bitmap, it's empty.
> how do i get my bitmap into my file? any help is appreciated.

Use the bitmap's SaveToStream method, e.g.

    bmpStrecke.SaveToStream (fs);

to save the bitmap and its LoadFromStream method to load it.

Re:Writing Strings, Integer, Bitmaps to a single file


Quote
"Bruce Roberts" <b...@bounceitattcanada.xnet> wrote in message news>
> Use the bitmap's SaveToStream method, e.g.

>     bmpStrecke.SaveToStream (fs);

> to save the bitmap and its LoadFromStream method to load it.

Hi Bruce,

thanks for your answer, but doesn't the stuff i loaded to the stream
before calling SaveToStream get wiped away, because LoadToStream
doesn't specify the location where to write?

Chris

Re:Writing Strings, Integer, Bitmaps to a single file


Quote
Chris wrote in message <93db72b0.0201300011.766f...@posting.google.com>...
>"Bruce Roberts" <b...@bounceitattcanada.xnet> wrote in message news>
>> Use the bitmap's SaveToStream method, e.g.

>>     bmpStrecke.SaveToStream (fs);

>> to save the bitmap and its LoadFromStream method to load it.

>Hi Bruce,

>thanks for your answer, but doesn't the stuff i loaded to the stream
>before calling SaveToStream get wiped away, because LoadToStream
>doesn't specify the location where to write?

No. Read up on TStream.Position, and ponder its implications.
Streams are _not_ one-shot; they are... well, streams.

Groetjes,
Maarten Wiltink

Other Threads