Re: line buffered stdin
ern0 <[email protected]>
| Newsgroups | gmane.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? -- To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html