c語言
安裝json
sudo apt-get install libjson0-dev
應用
測試程式:
#include #include "json-c/json.h"
#include int main(int argc, char *argv)
}");
printf("new_obj.to_string()=%s\n",json_object_to_json_string(new_obj));
new_obj = json_object_object_get(new_obj, "glossary");
printf("new_obj.to_string()=%s\n",json_object_to_json_string(new_obj));
new_obj = json_object_object_get(new_obj, "pagecount");
int pagecount = json_object_get_int(new_obj);
printf("page count=%d\n", pagecount);
json_object_put(new_obj);
//方法二
//建立字串型的json物件
json_object *j_str = json_object_new_string("test string ");
//建立乙個陣列物件
json_object *j_array = json_object_new_array();
//給元素新增到陣列末尾
json_object_array_add(j_array, json_object_new_string("china"));
json_object_array_add(j_array, json_object_new_string("autralia"));
json_object_array_add(j_array, json_object_new_string("french"));
//將上面建立的物件加入到json物件j_cfg中
json_object *j_cfg = json_object_new_object();
json_object_object_add(j_cfg, "str1", j_str);
json_object_object_add(j_cfg, "array1", j_array);
printf("j_cfg = %s\n", json_object_to_json_string(j_cfg));
//修改autralia為korea,在實際中需要搜尋autralia的位置idx,這個改變傳染到了j_cfg
json_object_array_put_idx(j_array, 1, json_object_new_string("korea"));
//刪除french
json_object_array_put_idx(j_array, 2, null);
json_object_a
printf("j_cfg = %s\n", json_object_to_json_string(j_cfg));
//將j_cfg儲存在project的根目錄下的檔案jcfg.dat中,該檔案沒有則新建,有則銷毀重新寫入 釋放
json_object_to_file("json.dat", j_cfg);
json_object_put(j_str);
json_object_put(j_array);
json_object_put(j_cfg);
return 0;
}編譯:gcc -o test test.c -l json-c
執行:./test
c++語音
安裝
sudo apt-get install libjsoncpp-dev
應用
測試程式:
#include #include #include "jsoncpp/json/json.h"
#include "jsoncpp/json/value.h"
#include "jsoncpp/json/writer.h"
using namespace std;
int main()
編譯:g++ -o test test.cc -l jsoncpp
執行:./test
PowerDesigner及UML建模應用
一 pd簡介 powerdesigner 是乙個集所有現代建模技術於一身的完整工具,它整合了強有力的業務建模技術 傳統的資料庫分析和實現,以及uml物件建模。通過了元資料的管理 衝突分析和真正的企業知識庫等功能。利用它可以製作資料流程圖 概念資料模型 物理資料模型 幫助企業快速高效地進行企業應用系統...
anaconda pycharm的安裝和應用
至於anaconda的安裝與pycharm的安裝在此不做多說,主要說下遇到的問題。問題描述 原因分析 anaconda自帶的python3.6作為預設python 解決方法 我覺得最省心的辦法就是把以前的python全部解除安裝了,就用anaconda。配置pycharm 在pycharm的file...
暑期課程python Python程式設計及應用
中文課程簡介 本課程針對廣泛應用的膠水語言python,講授python語言程式設計的基礎語法,及其在科學計算和人工智慧等方面的高階應用,促進學生掌握相關程式設計理論 培養利用程式解決問題的能力和素質具有重要的作用。課程以電力系統分析相關演算法為樣例,針對性地學習python資料組織格式 視覺化展示...