| 175 | } MainData; |
| 176 | |
| 177 | bool load_file_to_string(std::string& toRet, std::string_view fileName) { |
| 178 | // https://nullptr.org/cpp-read-file-into-string/ |
| 179 | std::ifstream file(fileName.data(), std::ios::in | std::ios::binary | std::ios::ate); |
| 180 | if(!file.is_open()) { |
| 181 | std::cout << "[load_file_to_string] Could not open file " << fileName << std::endl; |
| 182 | return false; |
| 183 | } |
| 184 | size_t fileSize; |
| 185 | auto tellgResult = file.tellg(); |
| 186 | if(tellgResult == -1) { |
| 187 | std::cout << "[load_file_to_string] tellg failed for file " << fileName << std::endl; |
| 188 | return false; |
| 189 | } |
| 190 | |
| 191 | fileSize = static_cast<size_t>(tellgResult); |
| 192 | |
| 193 | file.seekg(0, std::ios_base::beg); |
| 194 | |
| 195 | toRet.resize(fileSize); |
| 196 | file.read(toRet.data(), fileSize); |
| 197 | |
| 198 | file.close(); |
| 199 | return true; |
| 200 | } |
| 201 | |
| 202 | void get_refresh_rate(MainStruct& mS) { |
| 203 | mS.frameRefreshDuration = std::chrono::seconds(0); |
no test coverage detected