?
Solved

Interactive programming

Posted on 2003-03-17
8
Medium Priority
?
172 Views
Last Modified: 2010-04-15
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
0
Comment
Question by:nfuids
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 4

Expert Comment

by:pankajtiwary
ID: 8158520
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
 

Expert Comment

by:kuist
ID: 8160583
yeah, but what way do you suggest to handle the pausing of my process ?
0
 

Expert Comment

by:kuist
ID: 8160622
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Accepted Solution

by:
paul8883 earned 375 total points
ID: 8166492
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
 

Expert Comment

by:kuist
ID: 8182970
would you have a little example of Signal and/or name pipe?

Thanks
0
 

Expert Comment

by:kuist
ID: 8182995
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
 
LVL 20

Expert Comment

by:jmcg
ID: 10144413
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question