Configure ApacheRuntime
In the following process, click next
Configure CGI and release the configuration: AddHandler cgi-script. cgi
2. Add Option,
3. Write CGI Code as follows: <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> Vcd4kcjxwiggfsawdupq = "left"> # define_CRT_SECURE_NO_WARNINGS // cancel the security check
# Include
# Include
# Include
Voidmain ()
{
// If you want to display it in html, add the following two sentences:
Printf ("Content-type: text/html \ n ");
// Use the following method to query the environment variable string
Printf ("% s
", Getenv (" QUERY_STRING "));
CharszPost [256] = {0 };
// Obtain input
Gets (szPost );
// Obtain input
Printf ("% s
", SzPost );
// This statement moves the pointer to the equal sign position.
Char * p = szPost + 8;
Char * p1 = strchr (szPost ,"&");
* P1 = '\ 0 ';
Charcmd [256] = {0 };
// String ing
Sprintf (cmd, "% s> 1.txt", p );
System (cmd );
FILE * pf = fopen ("1.txt"," r ");
// Continue if it is not at the end of the file
While (! Feof (pf ))
{
Charch = fgetc (pf );
If (ch = '\ n ')
{
// Line feed
Printf ("
");
}
Else
{
// Print characters
Putchar (ch );
}
}
}
4. CLICK: local Windows Debugger
Open the file in file resource manager as follows:
The Debug directory is as follows:
5.change system.exebeibei to cgi-binin apachand system.exe to system. cgi.
6. Restart the Apache server and right-click Apach à Open Apache Monitor. The following page is displayed:
7. Compile the following html
It should be noted that, if an error still exists in the webpage, this may not be a program issue, but a cache issue. In this case, you should close the webpage and re-open it, this is the case.