hey,
I need to read from a file but withput using string...
I tried this...
// reading a text file
// reading a text file
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main () {
char line[120];
ifstream myfile ("example.txt");
if (myfile.is_open())
{
while ( getline (myfile,line) )
{
cout << line << '\n';
}
myfile.close();
}
else cout << "Unable to open file";
return 0;
}
It's still asking for string.. how can I make it work?