Help with blockread/blockwrite

Peter Norton qq88n at yahoo.com
Sun Feb 8 06:25:32 CET 2004


The Chief wrote:
> Please send an example of such code.

<code snippet>
bmpinfo = record (*BMP header*)
    b1, b2 : char;
    size : integer;
    reserved : integer;
    offset : integer;
    headersize : integer;
    width : integer;
    height : integer;
    planes : shortword;
    bpp : shortword;
    compression : integer;
    comprsize : integer;
    horresolution : integer;
    verresolution : integer;
    usedcolors : integer;
    importantcol : integer;
    end;
...
var
info : bmpinfo;
source : file of bmpinfo;
...
begin
...
assign(source, dir+fname+ext);
reset(source);
read(source, info);
close(source);
</code snippet>

This code reads first two bytes ok (magic BM), then
skips two byes (?) and from info.size all values are
shifted two bytes.
I have tried to use b1, b2 : byte or b1b2 : shortword
or b1b2 : shortint - no way. Also I have changed
source : file of byte and used blockread(source, info,
54) - no way, the same story.
The only solution I found with GPC (this code works
fine with FPC, VP) is to remove first two bytes out
from the record, then open source as file of bytes
and:

blockread(image, magic, 2);
blockread(image, info, 52);

Peter.

__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html




More information about the Gpc mailing list