Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
次の文字列が含まれているとしましょう。
{"ticker":{"high":8.976,"low":8.843,"avg":8.9095,"vol":2096.78,"last":8.845,"buy":8.946,"sell":8.843,"server_time":1343686701}}
数値を取得して別の変数に入れるにはどうすればよいですか?
例えば :
int high = 8.976 int low = 8.843 /* and so on */
たくさんの方法。
「sscanf」は1つの選択肢です。
標準の文字列関数「strstr()」、「atof()」などは別のものです。
優れたJSON解析ライブラリを見つけることをお勧めします。例えば: