I’m using Xcode 4.5 and I have the following code in my program:
char strChar[5];
cin.getline(strChar, 5);
int i = atoi(strChar);
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
*******UPDATE*********** 10/04/2012*********
APPLE HAS RELEASED AN UPDATE THAT FIXES THIS ISSUE. XCODE 4.5.1 (4G1004)
This is a known bug in Xcodes newest release (4.5). Apple knows about it and is working on a patch. Currently at press time, there is no known work around. For now you just have to run the program in Terminal.
** Note in newer versions of Xcode, the command line tools are not installed automatically **
To Install Go Into Xcode -> Preferences -> Downloads -> Install the command line tools
To Run C++ Programs in Terminal:
1.) Open Terminal.
2.) Navigate to the correct directory
3.) type “make projectName” minus the quotes
4.) Execute Program: “./projectName” minus the quotes