Once you've created the pipe, you can use fdopen to then create a file and attach it to that one of each of the pipes. For example, you can attach the file cfileinput to fd and cfileoutput to fd.
Then, if you open the cfileinput file from php and write to it, and everything you write to the file will be sent to your c program. You can also open the cfileoutput in php and read output from the c program.
Hope this helps.
RAD Software Systemsjohn@radsoftwaresys.com
We're RAD Software Systems, a software development and engineering firm that specializes in Rapid Application Development. Our team of software engineers uses state of the art agile methods, ensuring our clients deliver on time and on budget.
On my Gumstix Overo I am trying to create a Webpage as the GUI for a C program continuously running on it.
So far I have the Cherokee Webserver installed along with PHP. I've verified that I can put a php file into the website directory and it can be interpreted with the html results displayed on the browser.
Now I have to find some way to communicate between the webpage and a C program.
As a simple test I just want a button on the website that says "GO" and clicking on that will tell a C program to do something (change GPIO pin state, take an image with a UVC camera, etc). After that I'll add functionality like being able to read from temperature sensors, etc. The C program needs to run continuously without regard to whether the someone is at the website. The website is just to modify its behavior.
What's the easiest way to communicate via webpage and a C program?
Pipes? Using a file?
Should I even being using PHP to do this or some other scripting language?