• C

Interactive programming

Hi!

I have made a C program for linux.. and everything is fine.. now, I want to make a web page (PHP or perl) that will launch the program with the correct option..

how can I do so? and more important, is there any way to communicate with my programme once it has started to let's say pause/resume/stop it without killing the process because I have to save data prior to shuting it down..

Thanks
nfuidsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

pankajtiwaryCommented:
Well For CGI scripting through C u can use a package called cgic. It's a very good package which will certainly help you. As far as pausing the process is concerned you have to handle it manually because I don't any tool for this purpose.
0
kuistCommented:
yeah, but what way do you suggest to handle the pausing of my process ?
0
kuistCommented:
I had the same problem

and I finally didn't make it 'pausable' but someone suggested me to make it listed to a tcp port and have another process send the information that would make the first process pause.

my process was/is multithreaded, so what the guy said was to have a flag that should be turned to pause when ever the pause comand would come in via the tcp port.

but didn't know how to implement it, so I left it the way it was :)

hope this help a little =/
0
The Firewall Audit Checklist

Preparing for a firewall audit today is almost impossible.
AlgoSec, together with some of the largest global organizations and auditors, has created a checklist to follow when preparing for your firewall audit. Simplify risk mitigation while staying compliant all of the time!

paul8883Commented:
You can run the application from Perl script no matter what language you have used for writing the application (C, C++, ...). The problem is how the CGI writen in perl or PHP can control the external program for example writen in C. In the case both CGI and the C program are in the same machine, you have different options:

1) using signal, from the perl script CGI, send the signal to the child process (C program)

2) using the name pipe, the child process read the commands from the name pipe which the perl CGI will write.

3) using the socket, the child process listen a socket port for the command and the CGI write the command to the socket.

I would prefer to use signal cause it's quite easy to implement it. Also namepipe is not dfficult.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kuistCommented:
would you have a little example of Signal and/or name pipe?

Thanks
0
kuistCommented:
socket was my first thought of how to do it.. but if the other two are quite easy to implement.. I guess it could help :)


0
jmcgOwnerCommented:
Nothing has happened on this question in more than 9 months. It's time for cleanup!

My recommendation, which I will post in the Cleanup topic area, is to
accept answwer by paul8883 [grade B] (why is kuist asking followup questions?).

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jmcg
EE Cleanup Volunteer
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.