This commit is contained in:
jl777
2018-09-04 00:13:11 -11:00
parent ffd5a7a130
commit 2435962f20

View File

@@ -123,11 +123,11 @@ int32_t main(int32_t argc,char **argv)
{ {
cJSON *pjson,*bpi,*usd; cJSON *pjson,*bpi,*usd;
printf("Powered by CoinDesk (%s)\n","https://www.coindesk.com/price/"); printf("Powered by CoinDesk (%s)\n","https://www.coindesk.com/price/");
if ( (pjson= get_urljson("http://api.coindesk.com/v1/bpi/currentprice.json","")) != 0 ) if ( (pjson= get_urljson("http://api.coindesk.com/v1/bpi/currentprice.json")) != 0 )
{ {
if ( (bpi= jobj(pjson,"bpi")) != 0 && (usd= jobj(bpi,"USD")) != 0 ) if ( (bpi= jobj(pjson,"bpi")) != 0 && (usd= jobj(bpi,"USD")) != 0 )
printf("BTC/USD %.4f\n",jdouble(usd,"rate_float")); printf("BTC/USD %.4f\n",jdouble(usd,"rate_float"));
json_free(pjson); free_json(pjson);
} }
return(0); return(0);
} }