| 2 | #include <stdio.h> |
| 3 | |
| 4 | bool IBLLib::readFile(const char* _path, std::vector<char>& _outBuffer) |
| 5 | { |
| 6 | FILE* file = fopen(_path, "rb"); |
| 7 | |
| 8 | if (file == nullptr) |
| 9 | { |
| 10 | printf("Failed to open file %s\n", _path); |
| 11 | return false; |
| 12 | } |
| 13 | |
| 14 | // obtain file size: |
| 15 | fseek(file, 0, SEEK_END); |
| 16 | auto size = ftell(file); |
| 17 | rewind(file); |
| 18 | |
| 19 | _outBuffer.resize(size); |
| 20 | |
| 21 | // read the file |
| 22 | auto sizeRead = fread(_outBuffer.data(), sizeof(char), size, file); |
| 23 | fclose(file); |
| 24 | |
| 25 | return sizeRead > 0u; |
| 26 | } |
| 27 | |
| 28 | bool IBLLib::writeFile(const char* _path, const char* _data, size_t _bytes) |
| 29 | { |
nothing calls this directly
no outgoing calls
no test coverage detected