Comments (1)
错误信息如下:
#0 0x00007f7eef07a837 in raise () from /lib64/libc.so.6
#1 0x00007f7eef07be7a in abort () from /lib64/libc.so.6
#2 0x00007f7eef9b6192 in __gnu_cxx::__verbose_terminate_handler () at ../../../../libstdc++-v3/libsupc++/vterminate.cc:95
#3 0x00007f7eef9b4076 in __cxxabiv1::__terminate(void (*)()) () at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:47
#4 0x00007f7eef9b40b1 in std::terminate () at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:57
#5 0x00007f7eef9b42f3 in __cxxabiv1::__cxa_throw (obj=, tinfo=0x7f7eefc99690 ,
dest=0x7f7eef9b2500 std::bad_alloc::~bad_alloc()) at ../../../../libstdc++-v3/libsupc++/eh_throw.cc:95
#6 0x00007f7eef9b47bc in operator new (sz=280366331249121) at ../../../../libstdc++-v3/libsupc++/new_op.cc:54
#7 0x00007f7eefa4233b in std::__cxx11::basic_string<char, std::char_traits, std::allocator >::_M_mutate (
this=this@entry=0x7f7ee97f1e40, __pos=140183165624672, __len1=__len1@entry=0,
__s=0x7f7edc0f5e00 "[{"symbol":"ETHBTC","price":"0.02928100"},{"symbol":"LTCBTC","price":"0.01518500"},{"symbol":"BNBBTC","price":"0.00387090"},{"symbol":"NEOBTC","price":"0.00149900"},{"symbol":"QTUMETH","price":"0.0133"...,
__len2=16384) at /data/software/gcc-8.3.0/build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:310
#8 0x00007f7eefa438d3 in std::__cxx11::basic_string<char, std::char_traits, std::allocator >::_M_append (
this=0x7f7ee97f1e40, __s=, __n=)
at /data/software/gcc-8.3.0/build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/char_traits.h:287
#9 0x00000000004a938a in BinaCPP::curl_cb (content=0x7f7edc0f5e00, size=1, nmemb=16384, buffer=0x7f7ee97f1e40)
at /data/home/aron/topex.code.chuanxi/ygw-server/app/exchange-btcusdt/binance/binacpp.cpp:1768
#10 0x00007f7ef1170960 in Curl_client_write () from /lib64/libcurl.so
#11 0x00007f7ef118fb65 in inflate_stream () from /lib64/libcurl.so
#12 0x00007f7ef118ff6d in Curl_unencode_gzip_write () from /lib64/libcurl.so
#13 0x00007f7ef118a584 in Curl_httpchunk_read () from /lib64/libcurl.so
#14 0x00007f7ef1184b57 in Curl_readwrite () from /lib64/libcurl.so
#15 0x00007f7ef118ea5f in multi_runsingle () from /lib64/libcurl.so
#16 0x00007f7ef118f3b1 in curl_multi_perform () from /lib64/libcurl.so
#17 0x00007f7ef1186623 in curl_easy_perform () from /lib64/libcurl.so
#18 0x00000000004a972f in BinaCPP::curl_api_with_header (url=..., str_result=..., extra_http_header=..., post_data=..., action=...)
at /data/home/aron/topex.code.chuanxi/ygw-server/app/exchange-btcusdt/binance/binacpp.cpp:1825
#19 0x00000000004a943a in BinaCPP::curl_api (url=..., result_json=...)
at /data/home/aron/topex.code.chuanxi/ygw-server/app/exchange-btcusdt/binance/binacpp.cpp:1785
#20 0x00000000004a27dd in BinaCPP::get_allPrices (json_result=...)
at /data/home/aron/topex.code.chuanxi/ygw-server/app/exchange-btcusdt/binance/binacpp.cpp:95
#21 0x00000000004a299f in BinaCPP::get_price (symbol=0x7f7ee9ff2ff0 "BTCUSDT")
at /data/home/aron/topex.code.chuanxi/ygw-server/app/exchange-btcusdt/binance/binacpp.cpp:125修正方法:
CURLOPT_WRITEDATA这个选项在C++中使用时就要注意了,
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_WRITEDATA, void *pointer);
这里pointer必须是struct,不能是类class,否则会有莫名奇怪的错误
这样的后果是,最后下载的文件长度与原有长度不符,使用md5sum计算得到的校验值与标准值不符。这证明是错误的文件
参考代码:
size_t
BinaCPP::curl_cb( void content, size_t size, size_t nmemb, void response )
{
BinaCPP_logger::write_log( "BinaCPP::curl_cb " ) ;
//buffer->append((char*)content, size*nmemb);
size_t realsize = size * nmemb;
struct MemoryStruct* mem = (struct MemoryStruct *)response;
char *ptr = (char*) realloc((void*)mem->memory, mem->size + realsize + 1);
if(ptr == NULL) {
/* out of memory! */
printf("not enough memory (realloc returned NULL)\n");
return 0;
}
mem->memory = ptr;
memcpy(&(mem->memory[mem->size]), content, realsize);
mem->size += realsize;
mem->memory[mem->size] = 0;
BinaCPP_logger::write_log( "<BinaCPP::curl_cb> done" ) ;
return realsize;
}
from binacpp.
Related Issues (20)
- 链接报错一样 HOT 1
- https的接口无法获得行情、交易数据 HOT 3
- Issue: Example: make example HOT 1
- vcpkg
- Cannot make market trades HOT 2
- cURL fails initialization after send_order() HOT 2
- Build process upgrade
- Undefined reference to function in binance_utils string_toupper HOT 1
- How to close connect ws
- how to build on windows with mingw HOT 1
- The best C++ implementation of Binance API
- Wrong get_current_ms_epoch() Returned? HOT 1
- is This API Support MultiThreading? HOT 1
- Filter failure: PERCENT_PRICE HOT 2
- cannot find -ljsoncpp HOT 2
- Unable to get local issuer certificate.
- Robot commands(Check Binance inventory)
- Errors im getting: /usr/bin/ld: warning: librtmp.so.0, needed by ../lib/libcurl-7.56.0/lib/libcurl.so, not found (try using -rpath or -rpath-link) plus many others like 200 'undefined reference...`
- ERROR: -1106, Parameter 'timeInForce' sent when not required HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from binacpp.