Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ÓÃ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/C++³ÌÐòÔ±ÃæÊÔÌâ

PS:
      ½ñÌìÈ¥¸£ê¿²Î¼ÓËûÃǹ«Ë¾µÄ±ÊÊÔÁË£¬¿¼µÄ²»ÊǺÜˬ¡£¡£¡£¡£¡£Ò»Ð©ºÜ¼òµ¥µÄ¸ÅÄîÌ⣬²»ÖªµÀÔõô×÷´ð£¬¿´À´Òª¶à¶à¹®¹ÌÏÂÀíÂÛ֪ʶÀ²£¡£¡£¡£¡£¡£¡
ÒÔÏÂת:
ÎÒ´Óʼ¼Êõ¹¤×÷£¬
Õ⼸ÄêµÄÃæÊÔÓë±»ÃæÊÔ×ܽá
ÏÈ˵ÎÒÈ¥±»ÃæÊԵľ­Ñé°É¡£
»Ø´ðÇå³þÁË2¸öÎÊÌ⣬¾ÍÄÜ˳Àû¹ý¹ØÁË¡£
1¡£ÎªÊ²Ã´ÒªÀ뿪ÉÏÒ ......

[ZZ] C/C++³ÌÐòԱӦƸ³£¼ûÃæÊÔÌâÉîÈëÆÊÎö £¨¶þ£©

 3.ÄÚ¹¦Ìâ
¡¡¡¡ÊÔÌâ1£º·Ö±ð¸ø³öBOOL£¬int£¬float£¬Ö¸Õë±äÁ¿ Óë“ÁãÖµ”±È½ÏµÄ if Óï¾ä£¨¼ÙÉè±äÁ¿ÃûΪvar£©
¡¡¡¡½â´ð£º
¡¡¡¡¡¡BOOLÐͱäÁ¿£ºif(!var)
¡¡¡¡¡¡intÐͱäÁ¿£º if(var==0)
¡¡¡¡¡¡floatÐͱäÁ¿£º
¡¡¡¡¡¡const float EPSINON = 0.00001;
¡¡¡¡¡¡if ((x >= - EPSINON) && (x <= EPSI ......

C/C++±à³Ì¼¼ÄÜ¡¾ÕûÀí¡¿

Ô¤´¦ÀíÆ÷£¨Preprocessor£©
1. ÓÃÔ¤´¦ÀíÖ¸Áî#define ÉùÃ÷Ò»¸ö³£Êý£¬ÓÃÒÔ±íÃ÷1ÄêÖÐÓжàÉÙÃ루ºöÂÔÈòÄêÎÊÌ⣩
#define SECONDS_PER_YEAR (60 * 60 * 24 * 365)UL
ÎÒÔÚÕâÏë¿´µ½¼¸¼þÊÂÇ飺
1). #define Óï·¨µÄ»ù±¾ÖªÊ¶£¨ÀýÈ磺²»ÄÜÒԷֺŽáÊø£¬À¨ºÅµÄʹÓ㬵ȵȣ©
2). ¶®µÃÔ¤´¦ÀíÆ÷½«ÎªÄã¼ÆËã³£Êý±í´ïʽµÄÖµ£¬Òò´Ë£¬Ö±½Ó ......

cÀïÃæµÄðºÅ——λÓò¶¨ÒåÆ÷

 typedef struct _RTP_header {
        /* byte 0 */
        #if (BYTE_ORDER == LITTLE_ENDIAN)
            unsigned char csrc_len:4;        /* expect 0 */
&nb ......

Linux»·¾³MySQLµÄC±à³ÌÆð²½

Ê×ÏȰ²×°±ØÐèµÄ¿ª·¢
°ü
sudo apt-get install gcc g++ libgcc1 libg++ make gdb
°²×°MYSQLµÄCÓïÑÔ¿ª·¢°ü
sudo apt-get install libmysql++-dev libmysql++2c2a libmysqlclient15-dev libmysqlclient15off
°ÑlibÎļþ¿½±´µ½¹«ÓÃ
sudo cp /usr/lib/mysql/* /usr/lib/
½¨Á¢Ò»¸öÐÂÎļþtest.cpp
vim test.cpp
ÊäÈëÄÚÈÝ
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ