- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileManager.cpp
More file actions
Latest commit
24 lines (23 loc) · 558 Bytes
/
Copy pathFileManager.cpp
File metadata and controls
24 lines (23 loc) · 558 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include"FileManager.h"
/**
* \brief Reads a text file and returns all lines as a string vector.
* \param fileName Path & Name of the text file to read from.
* \return List of lines as strings from the text file.
*/
std::vector<std::string> FileManager::GetFileLines(const std::string& fileName) const
{
std::vector<std::string> lines;
std::ifstream src(fileName);
if (!src)
{
perror("Error opening file ");
system("pause");
return lines;
}
std::string line;
while (std::getline(src, line))
{
lines.push_back(line);
}
return lines;
}