23 lines
450 B
C++
23 lines
450 B
C++
#include "PrintFile.hpp"
|
|
#include <fstream>
|
|
#include <string>
|
|
#include <iostream>
|
|
using namespace std;
|
|
|
|
void PrintFile(const char *fileName)
|
|
{
|
|
ifstream inputFile(fileName);
|
|
if (inputFile.is_open())
|
|
{
|
|
string line;
|
|
while (getline(inputFile, line))
|
|
{
|
|
cout << line << endl;
|
|
}
|
|
inputFile.close();
|
|
}
|
|
else
|
|
{
|
|
cerr << "Error: Unable to open file " << fileName << endl;
|
|
}
|
|
} |