using namespace std;
#include <iostream>
#include <fstream>
#include <string>
#include <cstring>
int main()
{
ifstream InStream;
string InFile;
string InToken;
cout << "Please enter the filename: " << endl;
cin >> InFile;
InStream.open( InFile.c_str(), ios::in );
if (InStream.fail())
{
cerr << "Unable to open '" << InFile << "' for input." << endl;
}
const int MAX = 81;
char A[MAX];
cin.getline( A, MAX );
cout << A << endl;
}
There's my code -- what I'm trying to do is get the first line of files (assumed to be no more than 80 characters) stored into the char array A, and then display that array. This doesn't seem to be working for me, any tips?