高分求解,CGI程序怎么访问服务器的本地文件
在c程序里面有这样一个方法:
int log( char *input ) {
FILE * pFile;
pFile = fopen ("log.txt" , "w");
fwrite (input , 1 , strlen( input ) +1 , pFile);
fclose (pFile);
return 0;
}
该C程序编译后生成test.exe,然后改名为test.cgi。copy到IIS发布目录,C:\Inetpub\wwwroot\cgi\testDic\sample,该目录里面有log.txt文件,
如果不调用log("XXXX")方法,test.cgi能产生正确结果;一旦调用该方
法,HTML页面就返回出错信息:
CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:
无奈了,难道IIS连pFile = fopen ("log.txt" , "w")这种相对路径都不
认识么。
求解,我该怎么做才能访问到同一目录下的log.txt 。