Help for new programmer, PLEASE!

Discussion in 'Mac Programming' started by R.Youden, Nov 10, 2007.

  1. R.Youden macrumors 68020


    Apr 1, 2005
    Hi everyone.

    Ok this is the situation. I have a C program which is used for the demonstration of Adaptive Heuristic Critic and Q-learning reinforcement learning (but I suppose that isn't really important!). Now at the moment all this program does is read and write two text files and there is no form of GUI. At the moment I execute the file using the GCC complier in Terminal. Now what I would like to do is import the program into XCode so I can at least try and implement some form of GUI.

    Maybe all I need is a window where I can enter variables (rather than define them in my code) and something that can display my results on a grid rather than a list of values. My main output file is two locations and then a value for that location. If I could just create a file that provides a grid array rather than a list it would be great.

    If anyone could give me some advice or pointers I would be very grateful.

  2. ChrisA macrumors G4

    Jan 5, 2006
    Redondo Beach, California
    The simplest way to do this is to keep your program that way it is. Have it read from standard input and write to standard out. Then you write second program that accepts some user input and passes it to the first program, captures it's output and formats it for the screen. Such a simple GIU program does not need to be written in C. Use whatever scripting language you like.

    You can also make it web based. Basically you write a CGI script that calls your command line program.

    Converting your three column output file to a graphic cam be done without any programming if you use gnuplot (get it from fink)
    You can capture the output of gnuplot if you need to do somethig like embeed the plot in a web page or you can let gnuplot draw to the screen itself.

    Maybe you can guess I have a strong UNIX background. That's been the UNIX philosophy for the last few decades: Don't write special purpose programs -- string together some generic tools. The advantage is that you leverage the work of others.

Share This Page