How do I run a C programming language from Xcode on terminal? Please help me with this by answering a step by step procedure in doing this. Thanks.
Version 10.7.5 on a Macbook Air.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Xcode isn’t intended to run the program so that it displays its output in an external program like Terminal.app. It could probably be done by messing with the scheme configuration, but it’s probably not a good idea.
If you want a program’s output to appear in Terminal.app then you should run the program in Terminal. To do this go to your project’s build directory, find the executable and then copy the path into Terminal. Run the program.
Given your comment it’s not clear what you’re asking. It sounds like maybe you’re asking if the commands passed to
system()can also be used directly when running Terminal.app. The answer to that question is ‘yes’.You give an example
system("cls"). If you’re attempting to run the commandclsin Terminal.app and finding that it doesn’t work, the reason for that it’s a Windows command.system("cls")works only on Windows, and the commandclscan also be used directly in cmd.exe on Windows.system("cls")does not work on OS X, nor does a commandclswork in Terminal.app.The command that works in Terminal.app to clear the screen is
clear, and if you want to use this command from inside a C program you can usesystem("clear").