Opens a gzip (.gz) file for writing. * The compression level parameter should be in 0..9 * errno can be checked to distinguish two error cases * (if errno is zero, the zlib error is Z_MEM_ERROR). */
| 175 | * (if errno is zero, the zlib error is Z_MEM_ERROR). |
| 176 | */ |
| 177 | void open(const char* name, int level = Z_DEFAULT_COMPRESSION) { |
| 178 | char mode[4] = "wb\0"; |
| 179 | if (level != Z_DEFAULT_COMPRESSION) mode[2] = '0'+level; |
| 180 | if (m_fp) close(); |
| 181 | m_fp = ::gzopen(name, mode); |
| 182 | } |
| 183 | |
| 184 | /* open from a FILE pointer. |
| 185 | */ |