A simple xcode terminal interface??

Dear MacResearch Community,

I have what I believe/hope is a simple, perhaps stupid question.
I have various C++ codes that were written a number of years ago using Codewarrior and it's IDE. At that time I used the simple terminal (I think it was called the Sioux terminal) as my user interface. It was a simple terminal that popped up when the code was run to allow simple IO. Since porting this code to XCode, I can only run within Xcode itself, using the debugger console as the IO interface. I would very much like to be able to make this a stand alone application again (for among other reasons to be able to run multiple copies simultaneously and to be able to give copies to students etc without all the project files and source code. So, finally the question, is there an easy way to do this...or do I have to learn about building a GUI for my codes?

Thanks very much for any help/advise.

David

RE: A simple xcode terminal interface??

hi-

Launch Terminal application and type:

man gcc
man make

if you can compile and link your app to a runnable binary then type:

cd to_directory_of_your_program
./name_of_my_program

and your program will respond to stdin and stdout, the two standard input and output streams for unix. So, you type input which goes to your program using stdin (fscanf(stdin, format, &args)) and issue output to stdout (fprintf(stdout, format, args...) )

If you want, make new Terminal windows and repeat to run multiple copies of your app one one computer.

or use ./name_of_my_program < input_file &

(or something similar).

Thanks for the suggestion

HI,

Thanks for the suggestion and this is something I have used but what I left out of my original post was that I need (though that might be too strong a word) to use Xcode because the programs actually do some graphing and pop up some windows (which ported to Xcode with little problem). To use gcc from terminal I need to strip this out (which I've done) which also strips out the fuctionality.

David Newman
Physics Department
UAF

You can run things on the

You can run things on the command line, even if it is a standard .app wrapper.
For example

cd /Applications/TextEdit.app/Contents/MacOS/
./TextEdit

will launch TexEdit, you get all of the NSLog output (and stderr, stdout as well) on the command line. Windows will pop up. There isn't anything stopping you from doing text input through stdin. You will need to manually send display messages to NSView objects if you don't have a run loop.

If you are using the AppKit, you need a bundle, but you can create a pure command line Foundation tool.

David

RE: Thanks for the suggestion

It is definitely possible. See:

http://www.vvi.com/movies/vvizard.html

as an example.

thanks!-

-lance

In XCode when making a new

In XCode when making a new project you choose the "C++ tool" from "Command line utility"
I have several programs this way that work just fine from the terminal with interaction with gnuplot.
You just have to locate the unix executable in the build folders inside the project folder. (usually build/Debug)
Sometimes it works even ONLY in terminal since your programs might depend on some environment variables such as the PATH variable that looks where gnuplot might be located. These are not set when using the XCode console.

Willem

Check out this program

The open source program Bugs On The Run which I wrote in C and Carbon, has a terminal in it.
It's available on version tracker - http://www.versiontracker.com/dyn/moreinfo/macosx/28660
or on my site - http://homepage.mac.com/noamlenz/Menu1.html
Although my terminal is built with Carbon and Interface Builder, it is very simple and can accept output
from within the GUI program, in statements resembling C's printf.
If you want to add input, you'll have to modify it.
The amount of code that supports it are minimal and this was the only way I found to implement this function, after searching for a direct way to call a terminal from OS X, while having it remain an integrated part of my program, unsuccessfully.
If you do find a better way in the future, please let us know through this forum.

Noam