そこが肝心だ。std :: vectorを内部に含むバイナリファイルを読み書きする方法は?
私は次のようなことを考えていました:
//============ WRITING A VECTOR INTO A FILE ================
const int DIM = 6;
int array[DIM] = {1,2,3,4,5,6};
std::vector<int> myVector(array, array + DIM);
ofstream FILE(Path, ios::out | ofstream::binary);
FILE.write(reinterpret_cast<const char *>(&myVector), sizeof(vector) * 6);
//===========================================================
しかし、私はこのベクトルの読み方がわかりません。以下は正しいと思いましたが、そうではありませんでした。
ifstream FILE(Path, ios::in | ifstream::binary);
FILE.read(reinterpret_cast<const char *>(&myVector), sizeof(vector) * 6);
では、どのように操作を実行するのですか?