/
thomas-king
/
SourceManager
Обзор
Документация
Войти
/
thomas-king
/
SourceManager
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
lib/Services/FileManager.cpp
45 строк
818 B
Ace Rodstin
Task #39. Add write capability to SourceManager.
24 окт 2023, 15:32
24 окт 2023, 15:32
bfd3834
Код
Авторство
О чём код?
// // FileManager.cpp // SourceManager // // Created by Ace Rodstin on 10/24/23. // Updated by Ace Rodstin on 10/24/23. // // Copyright © 2023 Ace Rodstin. All rights reserved. // #include <vector> #include <sstream> #include "Services/FileManager.h" void FileManager::openFile(string path, OpenOption openOption) { ios::openmode mode; switch (openOption) { case FileManager::OpenOption::READ: mode = ios::in; break; case FileManager::OpenOption::WRITE: mode = ios::out; break; case FileManager::OpenOption::APPEND: mode = ios::app; break; } file = fstream(path, mode); } void FileManager::closeFile() { file.close(); } string FileManager::read() { stringstream stream; stream << file.rdbuf(); return stream.str(); } void FileManager::write(string text) { file << text; }