piping a web browser to a C program running in the shell
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
piping a web browser to a C program running in the shell
Hi,
I have a C program which requires 2 inputs,load average and time.I want to create a simple html page which accepts these two inputs in a form,and pipes these values to the C program,running in the shell,so as to make the input part GUI-enabled.
how can I accomplish this?
thanks
expelliarmus
I doubt that the piping can be done but I might be wrong. Some alternatives:
add your own basic webserver to your C application
add a native GUI to your C application
add a very basic server to your C application and use another application to send the input; the latter can be written in a number of scripting languages that have Tk support (I use Tcl/Tk, but I'm quite sure the python and perl also have Tk support)
Why can't you simply use CGI? In fact, the underlying mechanism for CGIs using the POST method is exactly as you describe. Your CGI would have to re-issue some sort of HTML page, in order to make the process re-iterate, but simply printing a static page to stdout is pretty simple to do in C.
Building a simple web server into your application is also a quite do-able. It can be accomplished in a few tens of lines, or there are open source mini-http servers out there for embedding.
--- rod.
Last edited by theNbomr; 10-10-2007 at 09:37 AM.
Reason: Added content.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.