さて、暗号化されたテキストをファイルに書き込もうとしています。
何らかの理由で、このスコープで宣言されていないというコンパイル エラーが発生します。
私のencryption.cppファイルは次のとおりです。
#include <iostream>
#include <fstream>
#include <string>
class encrypt{
public:
static void cryptText(std::string newpass)
{
int x = newpass.size();
int output[x -1];
for(int i = 0; i <= x -1; i++)
{
output[i] = (int)newpass[i];
std::cout << char(output[i] + x);
//Here I am trying to write output onto the file. For some reason, though,
//I get the error.
myfile.open ("passwords.thaddeus");
myfile << output << std::endl;
myfile.close();
}
std::cout << std::endl;
}
};
ファイルを使用した入出力に関する cplusplus.com のドキュメントを見てきました。サンプル プログラムを Code::Blocks にコピーしたところ、完全に機能しました。しかし、試してみると、エラーが発生します。を入れたからおかしい。