I've looked in the NSString class reference, but didn't find anything that looked correct. scanf("%i", &varName) isn't working. What am I doing wrong?
int varName;
NSLog (@"Enter a number: ");
scanf("%i", &varName);
NSLog (@"You entered %i.", varName);
When I run this, I get the prompt "Enter a number:" followed by a blinking cursor. However, when I enter a number (or a letter or a space or just press return) nothing happens. Cursor moves to a new line and waits for input. I have to stop the process from the Xcode console window.
Thanks in advance.
int varName;
NSLog (@"Enter a number: ");
scanf("%i", &varName);
NSLog (@"You entered %i.", varName);
When I run this, I get the prompt "Enter a number:" followed by a blinking cursor. However, when I enter a number (or a letter or a space or just press return) nothing happens. Cursor moves to a new line and waits for input. I have to stop the process from the Xcode console window.
Thanks in advance.