WPS文件直接显示及转换
本程序用Turbo C 2.0编写,源程序附下:
#include "stdio.h"
#include "stdlb.h"
#define FILE_EOF 26
main(argc,argv)
int argc;
char *argv[]
{
FILE *sf,*tf;
int data1,data2;
if (argc<2) {
printf("错误参数");
exit(0);
}
if ((sf=fopen(argv[1],"rb"))==NULL) {
printf{"错误文件名或文件未打到");
exit(0);
}
data1=getc(sf);
if (data1!=1) rewind(sf)
else {
fseek(sf,733L,0);
data1=getc(sf);
if (data1!=0) {
printf("文件已加密码");
exit(0);
}
fseek(sf,1024L,0);
}
if(argv[2]) tf=fopen(argv[2],"wb");
else tf=stdout;
while (data1!=FILE_EOF) {
data1=getc(sf);
fprintf(tf,"%c",data1);
}
fclose(sf);
} (黄河)