Name: Anonymous 2006-12-06 17:27
I was just thinking about how someone could do this, based on statements about how in the pre-gui days there were a lot of programs designed to just run other programs in sequence for user convenience, and after checking Google, I found this brief description of how to execute another program from within a C program:
http://antionline.com/showthread.php?t=273880
And elsewhere, a brief description of unistd.h and the definitions it contains. I can see a few neat uses for it, although some of those uses would be better fulfilled by simply adding the abilities of the foreign program to your header file, or some fancy use of a makefile.
One good use I can think of is doing this to make programs in different languages cooperate. And I'm wondering now how many languages I could get to talk to each other. C and C++ invoking each other is obvious. In an online, CGI environment, I might be able to cheat with fopen(page.php) to get the results of a PHP script, or it's possible neither fopen or execv will work correctly, but I'm confident I could get PHP to run C with eval(cprog.cgi) or file(cprog.cgi). I could do the same with any other language that can be used in CGI. Between C and JavaScript, I can at least get JS to run C with the same kind of request used for AJAX, although I don't think it's possible to do it the other way unless C actually interprets the JS itself. JS running PHP is kind of obvious, as that's what most AJAX does. What about doing it between other programming languages, or scripting languages more capable than JS?
http://antionline.com/showthread.php?t=273880
And elsewhere, a brief description of unistd.h and the definitions it contains. I can see a few neat uses for it, although some of those uses would be better fulfilled by simply adding the abilities of the foreign program to your header file, or some fancy use of a makefile.
One good use I can think of is doing this to make programs in different languages cooperate. And I'm wondering now how many languages I could get to talk to each other. C and C++ invoking each other is obvious. In an online, CGI environment, I might be able to cheat with fopen(page.php) to get the results of a PHP script, or it's possible neither fopen or execv will work correctly, but I'm confident I could get PHP to run C with eval(cprog.cgi) or file(cprog.cgi). I could do the same with any other language that can be used in CGI. Between C and JavaScript, I can at least get JS to run C with the same kind of request used for AJAX, although I don't think it's possible to do it the other way unless C actually interprets the JS itself. JS running PHP is kind of obvious, as that's what most AJAX does. What about doing it between other programming languages, or scripting languages more capable than JS?