cd /usr/local/src
wget http://zlib.net/zlib-1.2.12.tar.gz
tar -zxvf zlib-1.2.11.tar.gz
安装ZLIB
cd zlib-1.2.12
./configure
make
make install
保存用例
#include <stdio.h>
#include <string.h> // for strlen
#include <assert.h>
#include "zlib.h"
#include <iostream>
#include <fstream>
#include <sstream>
using std::cout; using std::cerr;
using std::endl; using std::string;
using std::ifstream; using std::ostringstream;
string readFileIntoString(const string& path) {
ifstream input_file(path);
if (!input_file.is_open()) {
cerr << "Could not open the file - '"
<< path << "'" << endl;
exit(EXIT_FAILURE)