Re: Libpq coding assistance - Mailing list pgsql-general

From Doug McNaught
Subject Re: Libpq coding assistance
Date
Msg-id m3y9lmtf9h.fsf@belphigor.mcnaught.org
Whole thread Raw
In response to Libpq coding assistance  (Scott Holmes <scottholmes@sbcglobal.net>)
List pgsql-general
Scott Holmes <scottholmes@sbcglobal.net> writes:

> ------------
>
>   lobj_fd = lo_open(conn, lobjId, INV_WRITE);
>
>   while ((nbytes = read(fd, buffer,BUFSIZE)) > 0)
>     {

>     }
>
> ------------
>
> I need to change the read() statement to use ReadFile, thus:
>
> ------------
>   lobj_fd = lo_open(conn, lobjId, INV_WRITE);
>
>   while (ReadFile(fd, buffer, BUFSIZE, &nbytes, NULL)!=EOF )
>     {

>     }
> --------------
>
> This, of course, doesn't work.  The program is reported as no longer
> responding.  An infinite loop I suspect. If anyone is doing this or
> knows how to code it, I would be grateful.

Sounds like ReadFile (a Windows call?) isn't behaving the way you
think it does.  Write some test code and play around with it until you
understand how it works.

-Doug
--
Let us cross over the river, and rest under the shade of the trees.
   --T. J. Jackson, 1863

pgsql-general by date:

Previous
From: elwood@agouros.de (Konstantinos Agouros)
Date:
Subject: Re: One more question about intervals
Next
From: "Aaron Rouse"
Date:
Subject: Restoring data help