Ander
Hi, I have a question about string manipulation in C:
I have a variable called recv_buf that stores the response of an HTTP request: This is an example of that response:
HTTP/1.1 200 OK
Server: nginx/1.16.1
Date: Thu, 14 Nov 2019 16:25:05 GMT
Content-Type: application/json
Content-Length: 873
Connection: keep-alive
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, OPTIONS
Access-Control-Expose-Headers: Content-Length,Content-Type,Date,Server,Connection
{"ok":true,"result":[{"update_id":954163176,
"message":{"message_id":2442,"from":{"id":xxxxxxxxx,"is_bot":false,"first_name":"Ander","last_name":"Mutuberria","language_code":"es"},"chat":{"id":xxxxxxxxxx,"first_name":"Ander","last_name":"Mutuberria","type":"private"},"date":1573668830,"text":"Test"}},{"update_id":954163177,
"message":{"message_id":2443,"from":{"id":xxxxxxxx,"is_bot":false,"first_name":"Ander","last_name":"Mutuberria","language_code":"es"},"chat":{"id":xxxxxxxxx,"first_name":"Ander","last_name":"Mutuberria","type":"private"},"date":1573669034,"text":"Test"}},{"update_id":954163178,
"message":{"message_id":2444,"from":{"id":xxxxxxxxx,"is_bot":false,"first_name":"Ander","last_name":"Mutuberria","language_code":"es"},"chat":{"id":xxxxxxxxxx,"first_name":"Ander","last_name":"Mutuberria","type":"private"},"date":1573669972,"text":"Test"}}]}
Do you know how can I extract from that char each "id" and "text" value and save it to a variable?
Thanks, any idea is welcomed.
Augmented
hi friends, i just wonder, should i use #define macros with variadic parameters, or its better to stick with templates... i want to customise code to be compatible simultaneously with few platforms/frameworks... for example Arduino/MBED/CMSIS for STM32