質問するログイン新規登録

回答編集履歴

2

微修正

2021/08/26 10:17

投稿

episteme
episteme

スコア16612

answer CHANGED
@@ -25,7 +25,7 @@
25
25
  using json = nlohmann::json;
26
26
 
27
27
  int main() {
28
- FILE* fp = fopen("foo.json", "r");
28
+ FILE* fp = fopen("a.json", "r");
29
29
  json j = json::parse(fp);
30
30
  fclose(fp);
31
31
  std::cout << j << std::endl; // coutに渡せば出力できる。

1

追記

2021/08/26 10:17

投稿

episteme
episteme

スコア16612

answer CHANGED
@@ -12,4 +12,22 @@
12
12
  std::cout << abc[1] << std::endl;
13
13
  }
14
14
  ```
15
- コレ↑でも遅いですか?
15
+ コレ↑でも遅いですか?
16
+
17
+ [追記] コチラ↓はいかがでしょう:
18
+
19
+ ```C++
20
+ #include <nlohmann/json.hpp>
21
+ #include <cstdio>
22
+ #include <iostream>
23
+
24
+ // for convenience
25
+ using json = nlohmann::json;
26
+
27
+ int main() {
28
+ FILE* fp = fopen("foo.json", "r");
29
+ json j = json::parse(fp);
30
+ fclose(fp);
31
+ std::cout << j << std::endl; // coutに渡せば出力できる。
32
+ }
33
+ ```