|
Slide 3.4: Calling a CGI Perl script Slide 3.6: Personal websites Home |
|
LIST.
It is used here to call a C/C++ run file:
system( "./CGIDemo '$name'" );where
CGIDemo is a C/C++ run file and
$name is the web input.
CGIDemo.cpp performs the following tasks:
$name.
| ~wenchen/public_html/cgi-bin/351/week3/CGIDemo.cpp |
#include <fstream>
#include <iostream>
#include <cstring>
using namespace std;
int main( int arc, char* argv[ ] ) {
char name[128];
fstream file;
file.open ( "cartoon.txt", fstream::in );
while ( 1 ) {
file.getline( name, 128 );
if ( file.eof( ) ) break;
if ( strstr( name, argv[1] ) != NULL )
cout << "Found: <em>" << name << "</em><br />";
}
file.close( );
}
|
http://people.cs.und.edu/~wenchen/cgi-bin/351/week3/CGIDemo.pl