急问,用C写CGI,访问此CGI要打开一个DOC文件,怎么处理?谢谢。
hfyou 2004-12-24 02:57:37 fprintf(stdout,"Content-Type: application/doc\r\n\r\n");
int fd, filesize;
fd = _open( "e:\\chi.doc", _O_RDONLY|_O_BINARY );
filesize = _filelength(fd);
char* buf= new char[filesize];
_read(fd, buf, filesize);
_close(fd);
_setmode( _fileno( stdout ), _O_BINARY);
fprintf(stdout, buf);
delete []buf;
return 0;
这样不行,应该怎么写??