Each time I try to compile I get the following 2 errors (lines 88 and 94 are highlighted in the code above):Code:int MP4010::get_rows( string& file_name ) { int count; int val; ifstream inFile(file_name); if(!inFile) { cerr<<"ERROR: The input file can not be opened."<<endl; exit(1); } while (inFile) { inFile.get(val); count += val == '\n'; } inFile.close(); return count; }
c:\...\mp_4010.cpp(88): error C2664: 'std::basic_ifstream<_Elem,_Traits>::basic_ifstrea m(const char *,std::_Iosb<_Dummy>:penmode)' : cannot convert parameter 1 from 'std::string' to 'const char *'
with
[
_Elem=char,
_Traits=std::char_traits<char>,
_Dummy=int
]I have no idea why this is happening. I am not converting between an int and a char, etc. Any ideas?c:\...\mp_4010.cpp(94): error C2664: 'std::basic_istream<_Elem,_Traits>::_Myt &std::basic_istream<_Elem,_Traits>::get(_Elem &)' : cannot convert parameter 1 from 'int' to 'char &'
with
[
_Elem=char,
_Traits=std::char_traits<char>
]
A reference that is not to 'const' cannot be bound to a non-lvalue