Hey guys, basically what I am trying to do is access the data from a previously created readFile function already made. I am supposed to be able to access the data and store it in my own way. Here is the readFile Function:Here is the Vessel Class:Code:void readFile(const char filename[], Vessel **vessels, Vessel **vessels2, int *vesselCount, int *cellCount, int *depth) { int ID; Vessel *ves, *ves2; ifstream inf(filename); inf >> *cellCount >> *vesselCount >> *depth; ves = new Vessel[*vesselCount]; ves2 = new Vessel[*vesselCount]; for(int i = 0; i < *vesselCount; i++) { inf >> ID; inf >> ves[ID].src >> ves[ID].dest >> ves[ID].capacity; ves2[ID] = ves[ID]; } // for i inf.close(); *vessels2 = ves2; *vessels = ves; } // readFile()
This is what I came up with(I have tried different alterations of this):Code:class Vessel { public: int src; int dest; int capacity; }; // class Vessel
And when I try making, I get this error(even with different alterations I end up with this error):Code:void getData(Vessel *vessels2) { Vessel *vessels3; *vessels3 = vessels2;//copying data to my own vessel array return; }//getData
prog5]$ make
g++ -Wall -ansi -g -c blood.cpp
blood.cpp: In function 'void getData(Vessel*)':
blood.cpp:8: error: no match for 'operator=' in '* vessels3 = vessels2'
bloodRunner.h:5: note: candidates are: Vessel& Vessel::operator=(const Vessel&)
make: *** [blood.o] Error 1
Can anyone tell me what I am doing wrong or give me a hint as to what I should do. I am not able to change the readFile function or the Vessel Class in any way. So I know I am definitely doing something wrong.
Thanks a lot for the help in advance!


Reply With Quote


Bookmarks