+1  A: 

I would start with a flash or java applet wrapper. You can communicate with your application over a tcp connection and display the results in the flash or applet.

Shane C. Mason
+4  A: 

CGI is what you want; it will let you embed any program you want into a website, it was made for that purpose. Then perhaps embedding a few more options with PHP and HTML will let the user acutally input data into the program via the web. It should not be too hard.

Take a look here for more info: http://www.cs.tut.fi/~jkorpela/perl/cgi.html

I think that is a good pointer in the right direction. I hope that helps.

Robert Massaioli
Thank you for your answer!
Masi
+2  A: 

Here's a good intro to writing CGIs in C: http://www.cs.tut.fi/~jkorpela/forms/cgic.html

However, since you're a beginner, I'd recommend porting your program to PHP. It's a very easy language to pick up, and it's a much easier route than writing a CGI in C.

splicer
+2  A: 

I assume the C program needs input while it's running and not via command-line arguments? If I'm wrong, you can just use PHP and shell_exec() to run the program. The function returns anything printed to stdout.

Such a page might look like:


    $sim = shell_exec("/path/to/binary -a 5 -b 6");
    echo $sim;

Where the string passed to shell_exec is exactly what you'd type on the command line.

Shadow
+4  A: 

You could run the C code in a flash app using alchemy:

http://labs.adobe.com/technologies/alchemy/

sean riley
This should be the answer. Nice find.
Shane C. Mason
I agree that this is a nice find (I did not know about it myself) but with my way users do not need flash. This way you can use free software all the way. Depending on your personality type (and likely Operating System) this may or may not be important to you. But it is important to me.
Robert Massaioli
+1  A: 

I would recommend going with sockets. If your C program could set up and listen on a local or internet socket, you could use the socket facilities in any language to send it arguments and get output.

If that's going to be too much of a pain, have php exec the program while directing the output to some file. Then, have php read that file.

Looking at the output of your program, I think trying to print the results of shell_exec() will result in clobbered output.

So, you could shell_exec("/bin/program -arguments > /tmp/prog-tmp.txt") , then read prog-tmp.txt.

Tim Post
Thank you for your answer! I will try your tip too.
Masi
+2  A: 

If you want a dynamic simulation, where the cars moves while you watch , you'll need an applet or flash.

A cgi program renders the page on each http GET/POST (on reload, submit etc) and that is probably not what you want.

KarlP