#include <fstream>
#include <iostream>
#include <string>
#include <stdio.h>
using namespace std;
int main()
{
string GetFileName;
cout << "System >> Enter file to read: \n";
cout << "User >> ";
cin >> GetFileName;
ifstream filename( GetFileName.c_str() );
if(! filename )
{
cout << "Unable to open file: " << GetFileName << endl;
return EXIT_FAILURE;
}
else
{
while (getline(filename, line)) //Loop through lines
{
char str[] = getline(filename, line);
char * pch;
pch = strtok (str," ");
while (pch != NULL)
{
printf ("%s\n",pch);
pch = strtok (NULL, " ");
}
}
filename.close();
}
return EXIT_SUCCESS;
}