write given buffer to the file, overwriting the file, it doesn't append to it.*/
| 5898 | |
| 5899 | /*write given buffer to the file, overwriting the file, it doesn't append to it.*/ |
| 5900 | void save_file(const std::vector<unsigned char>& buffer, const std::string& filename) |
| 5901 | { |
| 5902 | std::ofstream file(filename.c_str(), std::ios::out|std::ios::binary); |
| 5903 | file.write(buffer.empty() ? 0 : (char*)&buffer[0], std::streamsize(buffer.size())); |
| 5904 | } |
| 5905 | #endif //LODEPNG_COMPILE_DISK |
| 5906 | |
| 5907 | #ifdef LODEPNG_COMPILE_ZLIB |