Does anybody know how to use PHP's program execution functions eg exec(), system(), passthru() to call an external C program to do something? The platform used is Windows 98, Microsoft Personal Web Server(PWS), PHP 4.04pl1 and MySQL.
I am so not a windows guy.... but if your program is called "a.out" then i would assume that system("a.out") would do the trick. If you want to get stdout (or the, uh, dos equivalent) returns, use popen() which takes a second argument which is a pointer to buffered stdout. This pointer can be treated like a file pointer and data can be read. I don't know about stderr since I don't write C programs that produce errors 🙂
One other way to do this outside of using exec() or system() would be to set up the c/c++ app as a cgi and call to it thorugh http. Then you can just fopen it and use it like a module. Other applications you write then can call that same module easy as well. Who needs corba or dcom?! 😉
Can anyone please tell me whether it is possible at all to use PHP's program execution functions such as exec(), system(), passthru(), etc to call an external C program on Windows platform?