Sign in to follow this  
MDMcNeil

Objective-C Command Line

Recommended Posts

Hey guys!

I'm working in Objective-C at the moment as i am too broke to buy any C# books and instead of working with Cocoa for a graphical app at present, I am trying to get the basics down in a command line app.

My question is: Is there any way to get input from a command line app, or is it all just output? cin and cout from C++ don't work, but printf does from C.

Basically, I just want to be able to have a user type in a word, check it against a switch and output a string. Pretty simple, considering what Objective-C and C++ can do. I'm just hitting a wall that my current book doesn't overcome.

Or if anyone has any simple explanation of how ot connect a button to my code in Xcode for a cocoa app, that'd work too!

Thanks guys!

Share this post


Link to post
Share on other sites
Well, if printf works, I'm guessing [b]scanf[/b] will probably work too.

If it's not in your book, then it's a shame there isn't some kind of [url="http://lmgtfy.com/?q=objective+c+reading+from+command+line"]vast interconnected library you could access[/url].... [img]http://public.gamedev.net//public/style_emoticons/default/rolleyes.gif[/img]

Share this post


Link to post
Share on other sites
Lol, thanks ChaosEngine!

I had done a brief scan of the web for an answer, but I could probably be given the title of World's Worst Googler and found nothing the first couple attempts. I have since found that scanf works, I just gotta remember how to use it for strings.

Share this post


Link to post
Share on other sites
Objective-C compiler accepts C.

It is best for you to learn Objective-C by building a Cocoa App for the Mac or an iOS app.
The command-line app you are building is just C at the end.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this