// Showing try and catch for reading in files.
// By DreamVB 18:00 02/11/2016

#include <iostream>
#include <fstream>

using namespace std;
using std::cout;
using std::endl;

int main(int argc, char *argv[]){
	char *lzout = "C:\\Test\\input.txt";
	char buffer[80];

	ifstream fs;
	try{
		fs.open(lzout, ios::in);

		//Check if file was opened.
		if (!fs){
			throw ios::failure(string("Error Opening Source File."));
		}
		else{
			//Read and display the file.
			while (!fs.eof()){
				//Read line
				fs.getline(buffer, 80);
				//Write line
				if (strlen(buffer))
					cout << buffer << endl;
			}
			//Close the file.
			fs.close();
		}
	}
	catch (std::exception& e){
		cout << typeid(e).name() << endl << e.what() << endl;
	}

	system("pause");
	return 0;
}