[fpc-pascal] fpwrite buffers issues

Vincent Snijders vsnijders at quicknet.nl
Mon Oct 8 09:58:30 CEST 2007


ik schreef:

> Hello List,

<snip>

> 
> Then I tried to do the following code, that continue to write the
> buffer content until nothing more to write, but it reads wrong data:
> 
> start_count  := 0;
> output_count := readcount * sizeof(cshort);
> read_content := read_content_from....(... at Buffer[0], MAX_BUFFER);
> while (read_content > 0) do
>  begin
>    while (write_count > 0) do
>      begin
>        write_count := fpwrite (fd, @Buffer[start_count], output_count);
>        if (write_count > 0) then
>           begin
>             dec (output_count, write_count);
>             inc (start_count, write_count);
>           end ;
>     end;
// this seems missing:
	start_count  := 0;
	output_count := readcount * sizeof(cshort);

>    read_content := read_content_from....(... at Buffer[0], MAX_BUFFER);
> end;
> 
> I'm using ubuntu Linux amd64 using FPC 2.2.0
> 

Vincent



More information about the fpc-pascal mailing list