您好,我在我的 html 文件上打印前斜杠 '/' 时遇到问题,我需要从选择的输入中收集数据并将值发送到我的 .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>
下面的代码读取并打印以终止传递的文件。已使用您的文字进行测试。
#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;
}
用命令编译它:gcc -o test test.c -Wall -std=c99
然后调用它为:./test test.txt
我是一名优秀的程序员,十分优秀!