How do I get an NSString from console input, and then try to cast it into an int?
+3
A:
You can read in a char* string from console (scanf or whatever), like you would in a regular C program. Then, create an NSString object from it using stringFromCString:withEncoding:. Finally, use NSString's integerValue function to get it's numerical value.
codelogic
2009-01-29 22:29:40