C++ 将curl输出保存到文件

C++ 将curl输出保存到文件,c++,curl,C++,Curl,我希望最终结果只是一个包含以下行值的文件:- tx_散列_大_尾数,值 我也不确定如何删除其余不需要的数据。是否有我可以使用的boost函数?也许您应该开始检查错误条件和状态。的可能副本请显示您用于创建文件并写入文件的实际代码。编辑以添加代码、预期输出以及我希望最终得到的结果。谢谢,我没有注意到我的粘贴已排除了问题区域。也许你应该开始检查错误条件和状态。的可能副本请显示用于创建文件并写入文件的实际代码。编辑以添加代码、预期输出以及我希望最终得到的结果。谢谢,我没有注意到我的粘贴排除了问题区域。

我希望最终结果只是一个包含以下行值的文件:-

tx_散列_大_尾数,值


我也不确定如何删除其余不需要的数据。是否有我可以使用的boost函数?

也许您应该开始检查错误条件和状态。的可能副本请显示您用于创建文件并写入文件的实际代码。编辑以添加代码、预期输出以及我希望最终得到的结果。谢谢,我没有注意到我的粘贴已排除了问题区域。也许你应该开始检查错误条件和状态。的可能副本请显示用于创建文件并写入文件的实际代码。编辑以添加代码、预期输出以及我希望最终得到的结果。谢谢,我没有注意到我的粘贴排除了问题区域。
std::string window::btcunspent()

std::string address = "1BitcoinEaterAddressDontSendf59kuE";

std::string url;
url = "https://blockchain.info/unspent?active=" + address;

const char * c = url.c_str();

CURL *curl;
  CURLcode res;
  std::string readBuffer;

  curl = curl_easy_init();
  if(curl) {

    curl_easy_setopt(curl, CURLOPT_URL, c);
    curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
    curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
    res = curl_easy_perform(curl);
    curl_easy_cleanup(curl);
    }

std::ofstream myfile;
myfile.open("btcunspentraw.txt",fstream::out); 
myfile << readBuffer << std::endl;

std::string line;
getline (myfile,line);
boost::replace_all(line, "{\"unspent_outputs\"", "");
boost::replace_all(line, ":[", "");

myfile.close();

return readBuffer;
"unspent_outputs":[

    {
        "tx_hash":"f15c0393d76d26632f9416040a8205da1ff2e294e3ab793425fc95f51a249d36",
        "tx_hash_big_endian":"369d241af595fc253479abe394e2f21fda05820a0416942f63266dd793035cf1",
        "tx_index":827313,
        "tx_output_n": 0,
        "script":"76a914759d6677091e973b9e9d99f19c68fbf43e3f05f988ac",
        "value": 1000000,
        "value_hex": "0f4240",
        "confirmations":235503
    },

    {
        "tx_hash":"9f93847f8a773afb6873dea9f4104647a490d3af70f19f519ff57901f8216b45",
        "tx_hash_big_endian":"456b21f80179f59f519ff170afd390a4474610f4a9de7368fb3a778a7f84939f",
        "tx_index":827483,
        "tx_output_n": 1,
        "script":"76a914759d6677091e973b9e9d99f19c68fbf43e3f05f988ac",
        "value": 100000,
        "value_hex": "0186a0",
        "confirmations":235500
    },

    {
        "tx_hash":"47963eed62de8862d6d0ea1aebf2e18720677b428e5f9fa5e027ce81956c9f51",
        "tx_hash_big_endian":"519f6c9581ce27e0a59f5f8e427b672087e1f2eb1aead0d66288de62ed3e9647",
        "tx_index":836518,
        "tx_output_n": 0,
        "script":"76a914759d6677091e973b9e9d99f19c68fbf43e3f05f988ac",
        "value": 1000000,
        "value_hex": "0f4240",
        "confirmations":235264
    },