ÓÃC/C£«£«Ð´CGI³ÌÐò
ÓÃC/C£«£«Ð´CGI³ÌÐò
ʹÓÃCGIC¿âµÄ¼òÒª£º
¿âµÄº¯Êý˵Ã÷£º http://www.boutell.com/cgic/#cgiFormStringNoNewlines
1. ´òÓ¡CGI±ê×¼Êä³öÍ·²¿£º
cgiHeaderContentType£¨"text/plain"£©£»
»òÕߣº
fprintf£¨ stdout£¬ "Content-type£ºtext/plain\n\n"£©£»ºìÉ«²¿·Ö²»ÄÜд³ö“Contenttype”£¬·ñÔòä¯ÀÀÆ÷ÏÔʾÍøÒ³»á²»Õý³£¡£
2. ´¦ÀíRequest Method£º
//deal with "GET"/"POST" method
if (strncmp(cgiRequestMethod, "post",4) == 0)
{
handlePostRequest();
}
else //"GET"
{
handleGetRequest();
}
3. »ñÈ¡QueryStringÖеĸ÷¸ö×Ö¶ÎÖµ£º
cgiFormStringNoNewlines("query1", cmdstr, sizeof(cmdstr));
if (strcmp(cmdStr, "ip_address") == 0)
{
...
}
else
...
4. CGIÊä³ö£ºfprintf£¨cgiOut£¬ "%s\n"£¬ cgi_Output£©£»
ÒÔÏÂÊÇһЩϸ½Ú£º
Ò»¡¢ C/C++±àдCGI³ÌÐòÖ®form´¦Àí
1. GET
2. POST
3. ½áÊø
ÎÒÃÇÓÐÒ»ÕÅweb
test.html
<html>
<head>
<title>form test</title>
</head>
<body>
<form method="get" name="test-get" action="./cgi-bin/test-get.cgi">
<input name="name"><input name="pswd"><input type=submit value="get">
</form>
<br><br>
<form method="post" name="test-post" action="./cgi-bin/t
Ïà¹ØÎĵµ£º
[CÓïÑÔ]fopen()º¯ÊýµÄ²ÎÊý˵Ã÷
2007Äê06ÔÂ05ÈÕ ÐÇÆÚ¶þ 23:55
¸ñʽ£ºÎļþÖ¸ÕëÃû=fopen(ÎļþÃû£¬Ê¹ÓÃÎļþ·½Ê½)
²ÎÊý£º
ÎļþÃû ÒâÒå
"C:/temp/temp.txt" Îļþ C:\temp\temp.txt
ÎļþʹÓ÷½Ê½ ¡¡ Òâ Òå
“rt”¡¡¡¡¡¡¡¡¡¡Ö»¶Á´ò¿ªÒ»¸öÎı¾Îļþ£¬Ö»ÔÊÐí¶ÁÊý¾Ý
“wt”¡¡¡¡¡¡¡¡ ֻд ......
ÏÈÓñ´¶ûµÄÒ»µÀ±ÊÊÔÌâ¼òÒªµÄ˵Ã÷һϰɣº
¡¾Ì⡿˵Ã÷ÒÔϳÌÐò¡£
#include
int main(void)
{
unsigned int a[3] = {0x01020304, 0x05060708, 0x090a0b0c};
unsigned int *p = (unsigned int *)((int)a +1);¢Ù
printf("%x\n", *p);
return 0;
}
¡¾ÌâÄ¿½âÎö¡¿
Õâ¶Î³ÌÐòµÄÊä³ö½á¹ûÓ¦ ......
ÔÚÍøÉÏ¿´µ½ÁËÕâƪÎÄÕ£¬·Ç³£²»´í£¬»ñÒæ·Ëdz£¬ÓÚÊÇת¹ýÀ´£¬Ï£ÍûÄܶԴó¼ÒÓÐËùñÔÒæ¡£ÎÄÕÂÔ×÷Õߣºantigloss http://free3.e-168.cn/antigloss/
ºÜ¶àÈËÉõÖÁÊÐÃæÉϵÄһЩÊé¼®£¬¶¼Ê¹ÓÃÁËvoid main( ) £¬ÆäʵÕâÊÇ´íÎóµÄ¡£C/C++ ÖдÓÀ´Ã»Óж¨Òå¹ývoid main( ) ¡£C++ Ö®¸¸ Bjarne Stroustrup ÔÚËûµ ......
C/VCĿ¼²Ù×÷
Ðdz¾ ·¢±íÓÚ 2006-10-11 15:54:00
0
ÍƼö
Ò»¡¢Ä¿Â¼²Ù×÷º¯Êý½éÉÜ
ÔÚVC++µÄ“direct.h”Öж¨ÒåÁËÒÔÏÂ4¸öº¯Êý£º
int chdir(const char *); //change directory
char * getcwd(char *, int); //get current working directory
int mkdir(const cha ......
C
ÓïÑÔËùÓи´ÔÓµÄÖ¸ÕëÉùÃ÷£¬¶¼ÊÇÓɸ÷ÖÖÉùÃ÷ǶÌ×¹¹³ÉµÄ¡£ÈçºÎ½â¶Á¸´ÔÓÖ¸ÕëÉùÃ÷ÄØ£¿ÓÒ×ó·¨ÔòÊÇÒ»¸ö¼ÈÖøÃûÓÖ³£Óõķ½·¨¡£²»¹ý£¬ÓÒ×ó·¨ÔòÆäʵ²¢²»ÊÇC
±ê×¼ÀïÃæµÄÄÚÈÝ£¬ËüÊÇ´ÓC
±ê×¼µÄÉùÃ÷¹æ¶¨ÖйéÄɳöÀ´µÄ·½·¨¡£C
±ê×¼µÄÉùÃ÷¹æÔò£¬ÊÇÓÃÀ´½â¾öÈçºÎ´´½¨ÉùÃ÷µÄ£¬¶øÓÒ×ó·¨ÔòÊÇÓÃÀ´½â¾öÈçºÎ±çʶһ¸öÉùÃ÷µÄ£¬Á½Õß¿ ......