Can anyone tell me what is wrong with my code here:
void InterpretBatch(istringstream& linein)
{
string line, filename;
linein>>filename;
ifstream input(filename.c_str());
if (input.is_open())
{
while(getline(input,line))
{
cout<<line<<endl;
}
input.close(); //close the file
}
else
{cout<<"Could not Open file"<<endl;}
}
I'm using visual studio 2012. The code runs, but when I go over the input(filename.c_str()); in the debugger I can see that it doesn't want to open the file name I give it because it under 'input' in Locals it reads {_Filebuffer={_Set_eback=0x00000000 <NULL> _Set_egptr=0x00000000 <NULL> _Pcvt=0x00000000 {...} ...} } std::basic_ifstream<char,std::char_traits<char> >