Hi. I am trying to open and read a file in a certain way. This is what I have, which works:
Is anyone familiar with doing something similar with the following:Code:#include<fstream>
#include<iostream>
using namespace std;
int main(int argc, char* argv[])
{
ifstream the_file;
the_file.open(argv[1]);
char x;
the_file.get(x);
while(x!=EOF)
{
cout<<x;
the_file.get(x);
}
the_file.close();
return 0;
}
I am not familiar with this. Thanks in advance. SteveQuote:
ifstream in(string);
where string is a C-style string (that is a character array whose last character is '\0') that specifies a filename. Note that the values of argv[i] are all C-style strings. ...To get a C-style string from a C++ string called s, you call s.c_str().