Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Taking Command Line Input in Objective C

Tags:

objective-c

Is there anyway we can take input from command line in Objective-C, the way we can take in C/C++?

int inputVariableName;

cin >> inputVariableName;
like image 509
itsaboutcode Avatar asked Dec 10 '22 19:12

itsaboutcode


1 Answers

scanf("%i", userInput);

just as you would in c

To get Objective-C objects from the input, simple convert them after reading them in:

NSNumber * number = [nsnumber numberwithint:useriput];

like image 161
ennuikiller Avatar answered Dec 30 '22 22:12

ennuikiller