Re: Some encoding trouble via libpq
| От | Tom Lane |
|---|---|
| Тема | Re: Some encoding trouble via libpq |
| Дата | |
| Msg-id | 5795.1175212418@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Some encoding trouble via libpq ("Billy Gray" <billy.zophar@gmail.com>) |
| Ответы |
Re: Some encoding trouble via libpq
|
| Список | pgsql-general |
"William Gray" <billy.zophar@gmail.com> 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
В списке pgsql-general по дате отправления: