Can someone look at this code and tell me what is wrong with it?
I get the message.....
abnormal program termination!
I think it has to do with the while loop and the Substr function.
If I take out the while loop it will work but only on one line.
Code....
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <string>
#include <iomanip>
using namespace std;
int main ()
{
string inf;
string ouf;
cout << "What is the input file?\n";
cin >> inf; // Input File Name
cout << "What is the output file?\n";
cin >> ouf; // Output File Name
string Field;
string s;
ifstream fin(inf.c_str());
ofstream fout(ouf.c_str());
while (fin){
getline(fin, Field, '\n');
s = Field.substr(5, 16);
fout <<s <<endl; //output last name
} //End while loop
fin.close();
fout.close();
return 0;
}