Re: Re: Yikes! Bitten by line length? - Mailing list pgsql-novice

From Ian Lance Taylor
Subject Re: Re: Yikes! Bitten by line length?
Date
Msg-id sik87slbdc.fsf@daffy.airs.com
Whole thread Raw
In response to Yikes! Bitten by line length?  (Ken Corey <ken@kencorey.com>)
List pgsql-novice
Ken Corey <ken@kencorey.com> writes:

> Solaris' fgets function *only* returns the last part of a string if the
> string is over 256 bytes!  The test was this little program:
>
> #include <stdio.h>
> int main(int argc,char **argv) {
>   char line[1024];
>   while((fgets(line,1024,stdin)) != EOF) {
>     printf("Got '%s'\n",line);
>   }
> }
>
> Enter in really big lines (> 256 characters), and you'll see what I
> mean.

I very much doubt it is the fgets function.

I suspect it is the terminal driver.  The terminal driver only hands
data back to the application when it sees a newline.  It probably only
holds 256 characters.

Try using an editor to create a file with a line longer than 256
characters, and run `test < file', to see whether it is fgets or the
terminal driver.

Ian

pgsql-novice by date:

Previous
From: Laurel Williams
Date:
Subject: Postgres superuser password issue--update
Next
From: "Robert D. Nelson"
Date:
Subject: RE: Postgres superuser & password on Red Hat; upgrade