calling system() in cgi
Posted by Yenan (Yenan), 24 July 2003Hello,
I have a cgi script in C which I am using to make a system call. However I get no response from my linux shell when I run it on my web browser.
The cgi file is test.c:
"Content-Type:text/html;charset=iso-8859-1", 13, 10);
I should see "testing" appear on my linux shell where I run the program.
Posted by admin (Graham Ellis), 24 July 2003Welcome, Yenan. I have moved this topic here from the Perl forum, as the subject is the C language and not the Perl language.
As I understand it, the system() function creates a new process in which to run the command you give it (interpretted via the shell). Although the stdin and stdout of the CGI process are connected to the web server, this isn't the case with the the subshell - thus you see nothing.
I'm not very comfortable with using C and system calls for a CGI application - I think there might be a much better way of achieving what you want to do. If you can explain your application further, I'll try to suggest some alternatives
Posted by Yenan (Yenan), 25 July 2003Hello,
Thanks for your reply. What I am trying to do is modify graphic images via the browser. For example if a user has an image (.bmp, .jpeg etc) he can add text with certain fonts overlayed onto the image. I hoped to be able to used netpbm package to perform graphic manipulations. Do you have any other ideas ? Netpbm converter commands are executed using system calls.
Posted by admin (Graham Ellis), 25 July 2003Personally, I manipulate graphics with PHP which has some excellent libraries ...
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: firstname.lastname@example.org • WEB: http://www.wellho.net • SKYPE: wellho