Re: [Dev-C++] DELETE/SUPR in ANSI C + Get a char without ENTER
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Jason H. <jas...@bt...> - 2001-10-04 11:14:23
|
I'm not too upto date on the current standard for ANSI C as I use C++ more, but I think that the gets() (stdio.h) is in ANSI C and that will allow you to get a string and it will handle the delete key too. It's main flaw is that it doesn't check if you type in more chars than are in the string array. The only other way to do it is to write your own gets type of function, and include handling for special keys. For a sinle character I would normaly use getch() or getche() (conio.h), but I'm not so sure that they are ANCI C (anyone else know?). Another way would be to use getc()(stdio.h) and tell it to get input from "stdin", i.e. char c; c = getc(stdin); I don't know if that works, but it should. Jason. ----- Original Message ----- From: "Albert Vilella Bertran" <vil...@ya...> To: "DevC MAILING List" <dev...@li...> Sent: Thursday, October 04, 2001 10:48 AM Subject: [Dev-C++] DELETE/SUPR in ANSI C + Get a char without ENTER > Hello, > I wonder if anybody knows the "ANSI C" way to: > > (1) Allow the use of "delete" key or "supr" key while you are writing a long > word in > a scanf() and you mistype a key. > I always get the "[[3~" symbols and so on. > > (2) For 1 character scanf, there is any "ANSI C" way to press the char and not > to > need to press ENTER then? > > Thanks, and yes, I'm a beginner! > > _______________________________________________________________ > Do You Yahoo!? > Yahoo! Messenger: Comunicación instantánea gratis con tu gente - > http://messenger.yahoo.es > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |