[LCP]buffering problem

Greg Black gjb at gbch.net
Wed Sep 4 07:11:11 UTC 2002


Lucas King wrote:

| "Programs using the standard I/O library provided by UNIX automatically 
| buffer their output when running non-interactively.  This causes 
| problems when you need to see the output immediately."  ... it is 
| possible "to make the programs think they are running interactively, 
| thereby resolving the buffering problem."
| 
| the above is an exerpt from a manual.  the problem is, it doesn't go on 
| to explain how to make a program, e.g. FTP, think that it is running 
| interactively.

Read Stevens, as suggested in another message.  And read all the
man pages that refer to "pty".

| as with my Telnet session i am attempting to write a small interactive 
| FTP session in C.  the problem is that FTP is not passing the prompt 
| "ftp>" (because it is not terminated by a newline character) through to 
| my process, thereby making it difficult to determine when it is ready 
| for further commands.

Also read the man pages for setbuf, setvbuf and friends and for
fflush.

And learn how to use the apropos command, so that you can at
least read some of the relevant manuals before asking here.
These are not C programming questions, but simple basic Unix
programming issues.

Greg




More information about the linuxCprogramming mailing list