C++ can be quite confusing for me... Haven't touched this file in weeks and it has been compiling with no probs,now today after having been growing my project by modifying other classes, i get an error from a class which hasn't been modified and has been compiling
here's part of the class
I mean i never this problem, and this stream has been used this wayCode:#include "Fleet.h" #include <fstream> #include <iostream> #include <algorithm> #include <conio.h> using namespace std; struct CAR_MAKE { string make; string model; }; Fleet::Fleet(): fleet() {} Fleet::CarFleet Fleet::getFleet() { return fleet; } // --------------------------------------------------------------- // Implementing function to read fleet of cars from text file void Fleet::ReadFleetFromFile() { char filename[MAX_PATH] ; puts("\n\nPlease enter the text file to open:\n"); cin >> filename; istream fleetin; // Problem is here fleetin.open (filename); /* Ensure file was openned, otherwise send an error */ if ( fleetin.fail() ) { puts(""); perror("ERROR! while trying to open file"); exit(1); } else { Car car; // Read in fleet records while ( !car.Read(fleetin) ) { fleet.push_back(car); SortAlpha(); } // Did we read something? if( fleet.size()==0) { puts("\nData was unsuccessfully read !!..."); } else puts("\nProcessed reading..."); } fleetin.close(); } /* ERROR : error C2512: 'std::basic_istream<_Elem,_Traits>' : no appropriate default constructor available with [ _Elem=char, _Traits=std::char_traits<char> ] : error C2039: 'open' : is not a member of 'std::basic_istream<_Elem,_Traits>' with [ _Elem=char, _Traits=std::char_traits<char> ] : error C2039: 'close' : is not a member of 'std::basic_istream<_Elem,_Traits>' with [ _Elem=char, _Traits=std::char_traits<char> ] */



LinkBack URL
About LinkBacks



