Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #11106

Getting Input string without Pressing Enter of particular length

From bhutho <bdthombre@gmail.com>
Newsgroups comp.lang.c++
Subject Getting Input string without Pressing Enter of particular length
Date 2011-10-26 15:04 -0700
Organization http://groups.google.com
Message-ID <19429298.1072.1319666655063.JavaMail.geo-discussion-forums@prms22> (permalink)

Show all headers | View raw


Hello All,
I want to get the user input of string of particular length say three character after which user need not to press enter button and I should get the string in the variable.

string name;
cout << "Please enter the the three initial letters of your name: ";
cin >> name;


But the problem is I dont want the user to press enter after pressing the three initial. How can I do it?
_getch() allows me to get only one char. But I want to get the string of particular length. 
Please help!

Back to comp.lang.c++ | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Getting Input string without Pressing Enter of particular length bhutho <bdthombre@gmail.com> - 2011-10-26 15:04 -0700
  Re: Getting Input string without Pressing Enter of particular length Richard Damon <news.x.richarddamon@xoxy.net> - 2011-10-26 18:39 -0400
  Re: Getting Input string without Pressing Enter of particular length Juha Nieminen <nospam@thanks.invalid> - 2011-10-27 06:44 +0000
  Re: Getting Input string without Pressing Enter of particular length Turma 15 FCM <fcm.turma15@gmail.com> - 2011-10-28 07:24 -0700

csiph-web