I try tu run curl in C with this command (without libcurl) curl -X GET "https://dex.binance.org/api/v1/klines?symbol=&interval=&limit=&startTime=&endTime=
I created this script (in linux mint)
#include <stdlib.h>
int status = system("curl -X GET \"https://dex.binance.org/api/v1/klines?symbol=&interval=&limit=&startTime=&endTime=\"");
when I compile, I get this error:
test.c:3:14: error: initializer element is not constant
3 | int status = system("curl -X GET \"https://dex.binance.org/api/v1/klines?symbol=&interval=&limit=&startTime=&endTime=\"");
| ^~~~~~
Anyone can explain me why return this error?
You need a main
function in C. This is covered in the first chapter of your C text book.
You probably want something this:
#include <stdlib.h>
int main()
{
int status = system("curl -X GET \"https://dex.binance.org/api/v1/klines?symbol=&interval=&limit=&startTime=&endTime=\"");
...
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.