<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    隨筆-40  評論-66  文章-0  trackbacks-0
    啥都不說,直接看代碼!

    簡單輸出代碼

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    void main()
    {
    printf("Content-type:text/html\n\n");

    printf("hello world!");

    fflush(stdout);

    }



    處理get代碼

    #include <stdio.h>
    #include <stdlib.h>
    int zmain(void)
    {char *data;
    long m,n;
    printf("%s%c%c\n","Content-Type:text/html;charset=iso-8859-1",13,10);
    printf("<TITLE>Multiplication results</TITLE>\n");
    printf("<H3>Multiplication results</H3>\n");
    data = getenv("QUERY_STRING");
    if(data == NULL) 
    printf("<P>Error! Error in passing data from form to script.");
    else if(sscanf(data,"m=%ld&n=%ld",&m,&n)!=2) 
    printf("<P>Error! Invalid data. Data must be numeric.");
    else 
    printf("<P>The product of %ld and %ld is %ld.",m,n,m*n);
    return 0;
    }


    處理post代碼

    #include<stdio.h>
    #include<stdlib.h>
    void main()
    {
     int i,n;
     printf("Content-type:text/html\n\n");
     n=0;
     if(getenv("CONTENT_LENGTH"))
      n=atoi(getenv("CONTENT_LENGTH"));
     printf("%d",n);
     for(i=0;i<n;i++)
      putchar(getchar());
     putchar('\n');
     fflush(stdout);
    }



    還是代碼


    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>

    /* 轉換函數聲明 */
    int htoi(char *);

    /*  主函數 */
    void zmain() {
     int i,n;
     char c;
     printf ("Content-type: text/html\n\n");
     n=0;
     if (getenv("CONTENT_LENGTH"))
      n=atoi(getenv("CONTENT_LENGTH"));
     for (i=0; i<n;i++){
      
      int is_eq=0; //判斷是否有等于號。
      
      c=getchar();
      switch(c){
      case '&':
       c='\n';
       break;
      case '+':
       c='+';
       break;
      case '%':
       {
        char s[3];
        s[0]=getchar();
        s[1]=getchar();
        s[2]=0;
        c=htoi(s);
        i+=2;
       }
       break;
      case '=':
       c='=';
       is_eq=1;
       break;
      };
      
      putchar(c);
      //if (is_eq) putchar(' ');
     }
     putchar ('\n');
     fflush(stdout);
    }

    /* 轉換為小寫 */
    int islower (int ch ) 

    {
        return (unsigned int) (ch - 'a') < 26u;
    }


    /* convert hex string to int 16進制轉換成10進制 */
    int htoi(char *s)

    {
     
     char *digits="0123456789ABCDEF";
     
     if(islower(s[0])) s[0]=toupper(s[0]);
     if(islower(s[1])) s[1]=toupper(s[1]);
     
     return 16 * (strchr(digits, s[0]) -strchr(digits,'0') ) +(strchr(digits,s[1])-strchr(digits,'0'));
     
    }


    #include<stdio.h>
    #include<stdlib.h>
    void zzzmain()
    {
     int i,n;
     printf("Content-type:text/html\n\n");
     n=0;
     if(getenv("CONTENT_LENGTH"))
      n=atoi(getenv("CONTENT_LENGTH"));
     printf("%d",n);
     for(i=0;i<n;i++)
      putchar(getchar());
     putchar('\n');
     fflush(stdout);
    }

     

    posted on 2008-02-26 15:37 Super·shen BLOG 閱讀(747) 評論(0)  編輯  收藏

    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    主站蜘蛛池模板: 色噜噜亚洲男人的天堂| 亚洲综合激情五月色一区| 曰韩无码AV片免费播放不卡| 成年午夜视频免费观看视频| 亚洲伊人久久大香线蕉结合| 丁香花免费完整高清观看| 国产精品亚洲精品青青青| 男男AV纯肉无码免费播放无码| 亚洲校园春色另类激情| 在线观看特色大片免费视频| 亚洲中文字幕久久精品无码A| 成年女人18级毛片毛片免费 | 亚洲色欲www综合网| 9420免费高清在线视频| 亚洲国产成人精品无码区在线网站 | 国产亚洲精品美女久久久久| 国产精品嫩草影院免费| 免费无码国产在线观国内自拍中文字幕 | 国产乱妇高清无乱码免费| 亚洲精品无码mv在线观看网站| 国产一区二区三区免费| 久久亚洲日韩看片无码| 欧洲精品成人免费视频在线观看| 亚洲精华液一二三产区| 亚洲第一永久AV网站久久精品男人的天堂AV| 又硬又粗又长又爽免费看| 国产成人亚洲影院在线观看| 四虎成人免费影院网址| 中文字幕在线免费播放| 亚洲大码熟女在线观看| 窝窝影视午夜看片免费| 国产在线播放免费| 97在线免费观看视频| 亚洲午夜电影一区二区三区| 情侣视频精品免费的国产| 中国videos性高清免费| 亚洲一区二区三区91| 亚洲国产婷婷综合在线精品| 99久久免费观看| 亚洲AV成人无码网站| 久久精品亚洲一区二区|