I try to open a txt File for reading / writing in one task. My prior target is to exchange some characters by the saved ones in an array:
void Inputfile::decryptFile(string filename)
{
for(int i=0;i<15;i++)
{
fstream filedest(filename.c_str(), ios::in | ios::out);
if(!filedest)
cerr << "Konnte Zieldatei nicht oeffnen!
";
else
cout << endl << filename << " geoeffnet zum entschluesseln!
";
while(!filedest.eof())
{
filedest.get(ch);
if(ch == char(this->mostcharsencrypted[i]))
{
filedest.put(char(this->mostchars[i]));
}
}
filedest.close();
cout << "Fertig!";
}
}
mostcharsencrypted[] and mostchars[] are integer Arrays that hold the characters. I am sure that there is just 8 Bit Ansii Value in, and I check that even before this method gets called.
因此,如果目前读作的特性是目前阵列的位置(即:0至14)的特性,那么我就想与从主角的特征交换。
目前,我可以看到,我得到的正是配对类型,但我的笔记仍然显示同样的内容。