Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
calling system() in cgi

Posted by Yenan (Yenan), 24 July 2003
Hello,

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:

int main()
{
printf ("%s%c%c\n",
"Content-Type:text/html;charset=iso-8859-1", 13, 10);
system("echo testing");
}

I should see "testing" appear on my linux shell where I run the program.

Please help.

Posted by admin (Graham Ellis), 24 July 2003
Welcome, 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 2003
Hello,

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.

Thanks again.

Posted by admin (Graham Ellis), 25 July 2003
Personally, I manipulate graphics with PHP which has some excellent libraries ...



This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho