>> Would appreciate any help.
I think it would be best to start a separate thread and post your code and the exact error message. These types of errors can have many different causes.
This is a discussion on File handling with Array filled with a class within the C++ Programming forums, part of the General Programming Boards category; >> Would appreciate any help. I think it would be best to start a separate thread and post your code ...
>> Would appreciate any help.
I think it would be best to start a separate thread and post your code and the exact error message. These types of errors can have many different causes.
Persoanlly, I woudl just treat the class as if it were a struct. The member functions are only contextual, they dont actually occupy space in the object. You may want to use #pragma pack(1) to guarantee the smallest footprint
Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.
I declare it in my class and when I wnat to use the function as below I get the error message No match for operator[]. If I remove the line dayReport[i].dayOfMonth = dayP then it works but it is not read into the array.
Code:istream& operator >> (istream& fin, weatherReport dayReport[]) { Do something dayReport[i].dayOfMonth = dayP; }
I think you should be reading into a weatherReport & instead of into the array. That's just how it's done in C++. Move the code that loops through the array into a separate function and read into each weatherReport one at a time.