Re: line buffered stdin
ern0 <[email protected]>
| Newsgroups | org.kernel.vger.linux-c-programming |
|---|---|
| Message-ID | <[email protected]> |
> Is there a function that reads stdin without line buffering? You should set some terminal attr: termios oldt; [...] tcgetattr(STDIN_FILENO,&oldt); termios newt = oldt; newt.c_lflag &= (~ICANON & ~ECHO); tcsetattr(STDIN_FILENO,TCSANOW,&newt); and restore the old state when you're done: tcsetattr(STDIN_FILENO,TCSANOW,&oldt); If you interrupt your program, you will see no echo, which is annoying. Type - blind mode - at the shell prompt: "reset" (don't worry, it only resets the terminal). Gnome-terminal also clears the scrollback buffer upon "reset". -- ern0.scene.plus4.amiga.code.muzak Haben Sie Fragen?