FileReader.cpp 349 B

123456789101112131415161718
  1. //
  2. // Created by xcbosa on 2023/1/28.
  3. //
  4. #include "../webui.h"
  5. #include <sstream>
  6. #include <fstream>
  7. namespace xc::utils {
  8. string contentsOfTextFile(string filePath) {
  9. ifstream fin(filePath);
  10. stringstream buffer;
  11. buffer << fin.rdbuf();
  12. string str(buffer.str());
  13. fin.close();
  14. return str;
  15. }
  16. }