このコードを Python で C++ に変換します。
content = file(filename, "rb").read()
これは c++ のコードです。
ifstream file;
file.open(filename, fstream::binary);
file.seekg (0, ios::end);
long fileLength = file.tellg();
file.seekg(0, ios_base::beg);
char *content = new char[fileLength];
file.read(content, fileLength);
Pythonコードを実行すると、コンテンツに長い文字列(500文字〜)が表示されますが、C++コードは4文字しか返しません。
なにか提案を?
ありがとう