Currently I am developing a couple of C programs on my mac using Xcode. There however is 1 problem. My study requires me to use some sort of input field through the coding. So for instance if the users wants to run the program 10 times or wants the program to create 10 answers. I am using "atoi(argv[1])" just to get the input from the user.
This is exactly the problem. As soon as I run the program it just starts to bug, which is normal I quess because he is waiting for the input and not receiving it or something else. Anyways I tried to solve this problem with this link: How to run command-line application from the terminal?
This unfortunately didnt solve it either. I have already tried to re-install xcode, because just entering gcc in my terminal doesnt work either, but everytime the app store auto instals it for me.
Does anyone has a fix for my problem. I would greatly appreciate it due to the fact that next friday I have another deadline :( and I wont be getting a sufficient grade if my user input is not working.
Your help is again much appreciated!
Greetings,
Kipt Scriddy
EDIT: To clarify the problem. When running the script I want it to pop up in Terminal and wether there is an input field reguired it should ask for input. At the moment he is crashing immediatly due to the lack of input. He is not waiting for the argument to be passed from the users. He is skipping that part
HOWTO Pass command line arguments to your program from Xcode IDE
/phi
as the first argument, then 10
as the second.Noteworthy: This is also where you can specify the current working directory of your program at launch rather than the long, temp path Xcode uses when building your binaries. To do so:
That in combination with getting your parameter handling fixed in your program should get you up and running.