Hey guys,
I'm having a problem reading in a binary file.
Here's my snippet of code I'm trying to work with
I'm trying to get help out of some books and some online help sites, but haven't gotten anywhere with those.Code:#include <iostream> #include <fstream> #include <string> using namespace std; static unsigned short read_array[25198325]; int main() { //Tag directory of file const char *file1 = "/home/my_name/programs/InputFile.ima"; //Set input file reading fstream reader(file1, ios::in | ios::binary); if (!reader) { cout << "\nFile doesn't exist\n" << endl; return 0; } //char ch; istream &read(read_array, 25198320); //reader.read(read_array, 25198320); return 0; }
(i.e. I have no idea what I'm doing)
So, I'm trying to just read in data from a 50 MB binary file, and to store all the data in the array before I do anything else.
I get this with the code above
error: invalid initialization of non-const reference of
type 'std::istream&' from a temporary of type 'int'
I've tried to change the array to type char, but that hasn't worked either. It really doesn't like that istream &read line. Other than that, the file initialization part seems fine.
Anyone have any ideas? That would help alot![]()
Thanks,
Bri Rock



LinkBack URL
About LinkBacks
)



