Thread: [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: <vil...@ya...> - 2001-10-04 09:51:58
|
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 |
|
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 |
|
From: Ioannis V. <no...@ya...> - 2001-10-04 12:12:26
|
> -----Original Message----- > From: dev...@li...=20 > [mailto:dev...@li...] On Behalf=20 > Of Albert Vilella Bertran > Sent: Thursday, October 04, 2001 11:49 AM > To: DevC MAILING List > Subject: [Dev-C++] DELETE/SUPR in ANSI C + Get a char without ENTER >=20 >=20 > Hello, > I wonder if anybody knows the "ANSI C" way to: >=20 > (1) Allow the use of "delete" key or "supr" key while you are=20 > writing a long word in a scanf() and you mistype a key. I=20 > always get the "[[3~" symbols and so on. You can always use backspace... >=20 > (2) For 1 character scanf, there is any "ANSI C" way to press=20 > the char and not to need to press ENTER then? This feature is system dependend but on PCs the input stream is cached till the ENTER is pressed so although this behavior is not defined by ANSI, you can't. However you can use system extensions like getche() defined in conio.h. >=20 > Thanks, and yes, I'm a beginner! That's the point we all passed from. :) Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.f2s.com * Alternative URL: http://run.to/noicys |
|
From: Sayajin <sa...@if...> - 2001-10-04 12:56:24
|
Borland Builder C++ is the best ! And we have an utility which convert the files projets of Visual to files projets for Builder ! ! ! ----- Original Message ----- From: "Ioannis Vranos" <no...@ya...> To: "Dev-C++" <dev...@li...> Sent: Thursday, October 04, 2001 3:02 PM Subject: RE: [Dev-C++] DELETE/SUPR in ANSI C + Get a char without ENTER > -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Albert Vilella Bertran > Sent: Thursday, October 04, 2001 11:49 AM > To: DevC MAILING List > 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. You can always use backspace... > > (2) For 1 character scanf, there is any "ANSI C" way to press > the char and not to need to press ENTER then? This feature is system dependend but on PCs the input stream is cached till the ENTER is pressed so although this behavior is not defined by ANSI, you can't. However you can use system extensions like getche() defined in conio.h. > > Thanks, and yes, I'm a beginner! That's the point we all passed from. :) Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.f2s.com * Alternative URL: http://run.to/noicys _______________________________________________ Dev-cpp-users mailing list Dev...@li... https://lists.sourceforge.net/lists/listinfo/dev-cpp-users ______________________________________________________________________________ ifrance.com, l'email gratuit le plus complet de l'Internet ! vos emails depuis un navigateur, en POP3, sur Minitel, sur le WAP... http://www.ifrance.com/_reloc/email.emailif |
|
From: Jason S. <mys...@op...> - 2001-10-04 19:58:51
|
Though doesn't it not have the approval of the AP committee or some junk like that? They make us use metrowerks in school, and the teacher was mentioning something of the such one day about one of borland's products. Jason ----- Original Message ----- From: Sayajin To: Ioannis Vranos ; Dev-C++ Sent: Thursday, October 04, 2001 8:56 AM Subject: Re: [Dev-C++] DELETE/SUPR in ANSI C + Get a char without ENTER Borland Builder C++ is the best ! And we have an utility which convert the files projets of Visual to files projets for Builder ! ! ! |
|
From: Jason S. <mys...@op...> - 2001-10-04 20:02:02
|
Let me clarify that, I didn't mean that the AP committee might be RIGHT in what they think, I'm just disappointed we (possibly) can't use in school it because of that. :(
Jay
----- Original Message -----
From: Jason Silverman
To: Dev-C++
Sent: Thursday, October 04, 2001 3:58 PM
Subject: Re: [Dev-C++] DELETE/SUPR in ANSI C + Get a char without ENTER
Though doesn't it not have the approval of the AP committee or some junk like that? They make us use metrowerks in school, and the teacher was mentioning something of the such one day about one of borland's products.
Jason
----- Original Message -----
From: Sayajin
To: Ioannis Vranos ; Dev-C++
Sent: Thursday, October 04, 2001 8:56 AM
Subject: Re: [Dev-C++] DELETE/SUPR in ANSI C + Get a char without ENTER
Borland Builder C++ is the best ! And we have an utility which convert the
files projets of Visual to files projets for Builder ! ! !
|
|
From: Ioannis V. <no...@ya...> - 2001-10-04 21:14:12
|
Borland C++ Builder 5 is the best C++ RAD development tool currently for Windows. :) =20 This AP committee of yours must be something to US schools, fortunately here there is chaos and anyone is on his own. :) I think that too much committees can be a problem. =20 =20 Ioannis =20 * Ioannis Vranos * Programming pages: http://www.noicys.f2s.com <http://www.noicys.f2s.com/>=20 * Alternative URL: http://run.to/noicys -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Jason Silverman Sent: Thursday, October 04, 2001 10:02 PM To: dev...@li... Subject: Re: [Dev-C++] DELETE/SUPR in ANSI C + Get a char without ENTER Let me clarify that, I didn't mean that the AP committee might be RIGHT in what they think, I'm just disappointed we (possibly) can't use in school it because of that. :( =20 Jay ----- Original Message -----=20 From: Jason <mailto:mys...@op...> Silverman=20 To: Dev-C++ <mailto:dev...@li...> =20 Sent: Thursday, October 04, 2001 3:58 PM Subject: Re: [Dev-C++] DELETE/SUPR in ANSI C + Get a char without ENTER Though doesn't it not have the approval of the AP committee or some junk like that? They make us use metrowerks in school, and the teacher was mentioning something of the such one day about one of borland's products. =20 Jason ----- Original Message -----=20 From: Sayajin <mailto:sa...@if...> =20 To: Ioannis Vranos <mailto:no...@ya...> ; Dev-C++ <mailto:dev...@li...> =20 Sent: Thursday, October 04, 2001 8:56 AM Subject: Re: [Dev-C++] DELETE/SUPR in ANSI C + Get a char without ENTER Borland Builder C++ is the best ! And we have an utility which convert the files projets of Visual to files projets for Builder ! ! ! |