Click here to Skip to main content
15,916,835 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRemote Debugging and Breakpoints... Pin
Alberto Bar-Noy9-Mar-03 5:00
Alberto Bar-Noy9-Mar-03 5:00 
QuestionHow to handle Text Objects in a PaintShop Pro or PhotoShop type app? Pin
cdsmith9-Mar-03 4:57
cdsmith9-Mar-03 4:57 
Question.dsp and .dsw format ? Pin
CHARMAN9-Mar-03 4:21
CHARMAN9-Mar-03 4:21 
AnswerRe: .dsp and .dsw format ? Pin
Garth J Lancaster9-Mar-03 11:02
professionalGarth J Lancaster9-Mar-03 11:02 
GeneralRe: .dsp and .dsw format ? Pin
Garth J Lancaster9-Mar-03 11:05
professionalGarth J Lancaster9-Mar-03 11:05 
GeneralRe: .dsp and .dsw format ? Pin
Chris Richardson9-Mar-03 16:49
Chris Richardson9-Mar-03 16:49 
QuestionHow to embed MS Word into my app? Pin
blongtq9-Mar-03 4:02
blongtq9-Mar-03 4:02 
QuestionHow to put a Char into the Input buffer of a console? Pin
Aidman9-Mar-03 3:34
Aidman9-Mar-03 3:34 
Hi, me again Smile | :)

I am trying to write a program that loops an input until the escape key is pressed. But how do you put a single char into the input buffer so when the program requests a input the char will be displayed and removable by backspace key? Below is the basic what I have come so far but the problem is that “cin.putback(c);” does neither display the char “c” nor is it removable for the user, when pressing backspace key. I could add “cout << c;” but that only solves one problem, what do I need to do to make the char editable/removable for user when inputing?

char c;
while (1) {
c = getch();
switch (c) {
case 27: // Escape key is pressed
return 0;
case 13: // Enter key is pressed
//...
break;
default: // Some other key is pressed
cin.putback(c);
// Place char c into the input buffer,
// but it won't be displayed nor editable when input requested.
cin.getline(Text, 256);
// request input from user,
// the char c will be included in Text when user has finished input.
//...
}
}

Aidman » over and out
GeneralQuestion about Ms DataGrid Pin
ilavl9-Mar-03 3:00
ilavl9-Mar-03 3:00 
GeneralC++ & LDAP question Pin
Anonymous9-Mar-03 2:25
Anonymous9-Mar-03 2:25 
GeneralMemory from heap Pin
John-theKing9-Mar-03 0:32
John-theKing9-Mar-03 0:32 
GeneralRe: Memory from heap Pin
Christian Graus9-Mar-03 0:55
protectorChristian Graus9-Mar-03 0:55 
GeneralRe: Memory from heap Pin
Hesham Amin9-Mar-03 3:27
Hesham Amin9-Mar-03 3:27 
GeneralRe: Memory from heap Pin
Christian Graus9-Mar-03 10:16
protectorChristian Graus9-Mar-03 10:16 
GeneralMenu Pin
Dat Nguyen8-Mar-03 17:01
Dat Nguyen8-Mar-03 17:01 
GeneralRe: Menu Pin
Abbas_Riazi8-Mar-03 17:57
professionalAbbas_Riazi8-Mar-03 17:57 
QuestionHow to print Right aligned Text in a console? Pin
Aidman8-Mar-03 16:06
Aidman8-Mar-03 16:06 
AnswerRe: How to print Right aligned Text in a console? Pin
Alvaro Mendez8-Mar-03 16:47
Alvaro Mendez8-Mar-03 16:47 
GeneralRe: How to print Right aligned Text in a console? Pin
Aidman9-Mar-03 1:05
Aidman9-Mar-03 1:05 
GeneralClarifying Terminology for "XP Job Control" Pin
Dana Epp8-Mar-03 14:28
Dana Epp8-Mar-03 14:28 
GeneralShortcut keys Pin
Dor8-Mar-03 13:57
Dor8-Mar-03 13:57 
GeneralRe: Shortcut keys Pin
Nish Nishant8-Mar-03 14:11
sitebuilderNish Nishant8-Mar-03 14:11 
Generalfast line drawing Pin
TV8-Mar-03 13:48
TV8-Mar-03 13:48 
GeneralRe: fast line drawing Pin
Anders Molin8-Mar-03 14:11
professionalAnders Molin8-Mar-03 14:11 
GeneralRe: fast line drawing Pin
TV8-Mar-03 14:15
TV8-Mar-03 14:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.