Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void FileWriter::WriteToFile(std::string * fileLocation, std::string * fileText)
- {
- std::ofstream thisFile;
- thisFile.open (* fileLocation);
- thisFile << * fileText;
- thisFile.close();
- }
- std::string FileWriter::ReadFromFile(std::string * fileLocation)
- {
- std::string strToReturn;
- std::string line;
- std::ifstream thisFile(* fileLocation);
- if (thisFile.is_open())
- {
- while (std::getline(thisFile, line))
- strToReturn += line + "\n";
- thisFile.close();
- }
- else
- std::cout << "Invalid file location" << std::endl;
- return strToReturn;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement