Html 如何在C中打印正斜杠?

Html 如何在C中打印正斜杠?,html,c,bash,cgi,Html,C,Bash,Cgi,您好,我在html文件上打印前斜杠“/”时遇到问题,我需要从select输入中收集数据并将值发送到.cgi文件,但当我选择像“/home”这样的值时,它会打印“%2Fhome”如何解决此问题?谢谢你的回答 Shell: <select name=shell> <option value="/bin/bash">/bin/bash</option> <option value="/bin/sh">/bin/sh</option&

您好,我在html文件上打印前斜杠“/”时遇到问题,我需要从select输入中收集数据并将值发送到.cgi文件,但当我选择像“/home”这样的值时,它会打印“%2Fhome”如何解决此问题?谢谢你的回答

Shell: <select name=shell>
    <option value="/bin/bash">/bin/bash</option>
    <option value="/bin/sh">/bin/sh</option>
    <option value="/usr/bin/csh">/usr/bin/csh</option>
    <option value="/bin/false">/bin/false</option>
    </select><br>
Shell:
/bin/bash
/垃圾箱/垃圾箱
/usr/bin/csh
/垃圾箱/错误


读取并打印下面的代码,以终止传递的文件。测试你的文本

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

int main(int argc, char *argv[])
{
    FILE *fd;

    if (argc < 2)
    {
        return EXIT_FAILURE;
    }

    // Open requested file
    fd = fopen(argv[1], "rb");

    // Check file opened
    if ( fd == NULL )
    {
        // Couldn't open file
        return EXIT_FAILURE;
    }

    // Step through the file until EOF occurs
    int c;
    while ((c = fgetc(fd)) != EOF) {
        printf("%c", c);
    }

    // Close file
    fclose(fd);

    return EXIT_SUCCESS;
}
#包括
#包括
int main(int argc,char*argv[])
{
文件*fd;
如果(argc<2)
{
返回退出失败;
}
//打开请求的文件
fd=fopen(argv[1],“rb”);
//检查打开的文件
如果(fd==NULL)
{
//无法打开文件
返回退出失败;
}
//逐步浏览该文件,直到出现EOF
INTC;
而((c=fgetc(fd))!=EOF){
printf(“%c”,c);
}
//关闭文件
fclose(fd);
返回退出成功;
}
使用命令编译它:
gcc-o test test.c-Wall-std=c99


然后将其称为:
/test.txt

HTTP POST数据是URL编码的,它将特殊字符替换为%后跟十六进制代码。您应该使用CGI库对其进行解码。