Skip site navigation (1) Skip section navigation (2)

Re: Re: Yikes! Bitten by line length?

From: Ian Lance Taylor <ian(at)airs(dot)com>
To: ken(at)kencorey(dot)com
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Re: Yikes! Bitten by line length?
Date: 2001-01-18 22:54:39
Message-ID: sik87slbdc.fsf@daffy.airs.com (view raw or flat)
Thread:
Lists: pgsql-novice
Ken Corey <ken(at)kencorey(dot)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

In response to

Responses

pgsql-novice by date

Next:From: Ken CoreyDate: 2001-01-18 23:05:07
Subject: Argh! What's a 'bpchar'? (copy/serial issues...I think)
Previous:From: Laurel WilliamsDate: 2001-01-18 22:30:18
Subject: Postgres superuser password issue--update

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group