Search Postgresql Archives

Re: Some encoding trouble via libpq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"William Gray" <billy.zophar@xxxxxxxxx> writes:
> ... And in the case
> that fread() pulls in less data than requested, that means the next call to
> fread() should return zero, right?

Wouldn't count on that, particularly not when reading from an
interactive device.  You are more likely to get a line per call.

What's bothering me about your code is that it assumes there are
exactly STDIN_BLOCK bytes available in the buffer when you call
fread, and the code does nothing that guarantees that.  Personally
I'd have used "size - offset" as the fread length parameter and not
had to worry.

			regards, tom lane


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux