Help with blockread/blockwrite

Peter Norton qq88n at yahoo.com
Thu Feb 5 17:10:57 CET 2004


I have simple file copy example:

var
infile,outfile:	file;
buff:		array[1..512] of byte;
copied:		integer;
begin
assign(infile, 'input');
reset(infile, SizeOf(byte));
assign(outfile, 'output');
rewrite(outfile, SizeOf(byte));
repeat
	blockread(infile, buff, 512, copied);
	blockwrite(outfile, buff, copied);
until copied < 512;
close(infile);
close(outfile);
end.

It works fine. But if before repeat loop I placed:

blockread(infile, buff, 1);
blockwrite(outfile, buff, 1);

it copy only 16384 (2^14) bytes of input. Always.
If input file is smaller than 2^14 bytes then it
copied all bytes. If larger then it cutted down to
2^14 bytes.

I have this behaviour with GPC only. No problems with
FPC, VP...

What is wrong?

Thanks in advance,
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