//the idea, is for it to be cross platform, and open files in binary mode
#include %26lt;iostream%26gt;
#include %26lt;stdlib.h%26gt;
using namespace std;
int main()
{
string input;
cout %26lt;%26lt;"please input the full file name:"%26lt;%26lt;endl;
cin %26gt;%26gt;input;
cout %26lt;%26lt;endl%26lt;%26lt;endl;
ifstream file(input, binary);
file %26gt;%26gt;input;
cout %26lt;%26lt;input;
return 0;
}/*keep getting this error: "binary_file_reader.cpp:10: error: variable 鈥榮td::ifstream file鈥?has initializer but incomplete type"*/|||You need to #include %26lt;fstream%26gt;
also, the call to fstream's constructor should be
ifstream file(input.c_str(), ios::binary);
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment