问题一:如何从文件中取得字符 而 不跳过空格和回车符?问题二:下边这个程序先取一个字节,然后判断想加密就加8;解密就减8.用大点的文本文件一试,总出错.检查也检查不出,请大虾指点一下错在何处,或者有别的思路简单加密解密一下文本文件?谢谢~~~#include<iostream.h> // cin and cout stream operation
#include<fstream.h> // file operation
#include<stdlib.h>  // function exit()
#include<string.h>  //strcmp()void encrypt(char *&encryptfile,int tag)
{
fstream readwritefile;
readwritefile.open(encryptfile,ios::out|ios::in);
if(!readwritefile)
{
cerr<<"文件打开失败!";
exit(1);
}
char temp;
long location;
while(readwritefile>>temp)
{
if(tag)temp+=8;
else temp-=8;
location=readwritefile.tellg();
readwritefile.seekp(location-1,ios::beg);
readwritefile<<temp;
}
readwritefile.close();
}int main(int argc,char *argv[],char *env[])
{
if(strcmp(argv[2],"jia")) encrypt(argv[1],1);
else if(strcmp(argv[2],"jie")) encrypt(argv[1],0);
cout<<"ok";
return 0;
}