[問題] 利用nlohmann json 讀取發生錯誤
開發平台(Platform): (Ex: Win10, Linux, ...)
Win10
編譯器(Ex: GCC, clang, VC++...)+目標環境(跟開發平台不同的話需列出)
VC2017
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
nlohmann/json
問題(Question):
欲利用josn 讀取一個從cline接收到的字串,
可以依據其key 讀取value ,
讀取時發生錯誤
餵入的資料(Input):
client傳送來的文字串
[
{
"_id": "5acb0a9494eb20cde1dbe689",
"index": 0,
"guid": "210941f6-9151-4315-8dfe-d7e0485afb18"
},
]
預期的正確結果(Expected Output):
auto keep = j_from_cbor["_id"] ; // keep = 5acb0a9494eb20cde1dbe689
錯誤結果(Wrong Output):
程式錯誤
程式碼(Code):(請善用置底文網頁, 記得排版,禁止使用圖檔)
https://ideone.com/vxFCgF
補充說明(Supplement):
加入第150行欲讀取時發生錯誤。
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 60.248.167.253
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1523256414.A.543.html
※ 編輯: smartjay (60.248.167.253), 04/09/2018 14:48:42
→
04/09 16:57,
6年前
, 1F
04/09 16:57, 1F
→
04/09 17:47,
6年前
, 2F
04/09 17:47, 2F
→
04/09 17:47,
6年前
, 3F
04/09 17:47, 3F
→
04/09 17:48,
6年前
, 4F
04/09 17:48, 4F