I’m using Xcode 4.5 and I have the following code in my program:
string str;
char strChar[5];
cin.getline(strChar, 5);
int i = atoi(str.basic_string::c_str());
When I start to try and enter a number, after the first number is pressed, the console will not accept any more input (other than the enter key, in which case the program just returns zero straight away). Obviously, I want to accept more than one character, how can I accomplish this?
Thanks for answering my question
This entry was posted in Codes & Scripts and tagged Character, getline, reads. Bookmark the permalink.