[fpc-pascal] fpwrite buffers issues
ik
idokan at gmail.com
Fri Oct 12 12:33:46 CEST 2007
Hi Sorry for the delay in responding
On 10/8/07, Vincent Snijders <vsnijders at quicknet.nl> wrote:
> 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);
Well it was missing from my PoC :) but the problem still exists.
I'm attaching the full program (it goes to libsdnfile).
>
> > read_content := read_content_from....(... at Buffer[0], MAX_BUFFER);
> > end;
> >
> > I'm using ubuntu Linux amd64 using FPC 2.2.0
> >
>
> Vincent
Thank you,
Ido
--
http://ik.homelinux.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sfplay.pp
Type: application/octet-stream
Size: 7705 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20071012/aed1b691/attachment-0001.obj>
More information about the fpc-pascal
mailing list