![]() |
| | #1 |
| Registered User Join Date: Oct 2006
Posts: 3
| How to have fgets() return edited line like in shell? Code: while (fgets(buf, sizeof(buf), stdin))
do_command(buf);
I tried first calling noraw() and nocbreak(), but it does make a difference. Thanks |
| hkluis is offline | |
| | #2 |
| Registered User Join Date: Oct 2004
Posts: 151
| Look into GNU Readline.
__________________ System: Debian Sid and FreeBSD 7.0. Both with GCC 4.3. Useful resources: comp.lang.c FAQ | C++ FQA Lite |
| zx-1 is offline | |
| | #3 |
| Registered User Join Date: Oct 2006
Posts: 3
| Thank you. That works and is very simple. You would think there would be an option in the shell to have all fgets(stdin) automatically inherit this behavior, so that it would not be necessary to modify the apps. |
| hkluis is offline | |
| | #4 |
| Registered User Join Date: Oct 2006
Posts: 3
| Actually, I came across "rlfe" which is a wrapper for readline. That might just do it. |
| hkluis is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| help again with scrolling without wrapping | Dukefrukem | C Programming | 8 | 09-21-2007 12:48 PM |
| Another weird error | rwmarsh | Game Programming | 4 | 09-24-2006 10:00 PM |
| Why only 32x32? (OpenGL) [Please help] | Queatrix | Game Programming | 2 | 01-23-2006 02:39 PM |
| C++ FTP class won't work | lord mazdak | C++ Programming | 8 | 12-18-2005 07:57 AM |
| opengl program as win API menu item | SAMSAM | Game Programming | 1 | 03-03-2003 07:48 PM |