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