引用头文件:
#include <string>
#include <iostream>
#include <fstream>
#include <cassert>
#include <stdio.h>
#include <io.h>
#include<sstream>
#include <vector>
#include "CJsonObject.hpp"
using namespace std;
using namespace neb;
CJsonObject Objson;
1 __declspec(dllexport) void __stdcall read_JSon(char* path)
2 {
3 ifstream t(path);
4 string str((istreambuf_iterator<char>(t)),istreambuf_iterator<char>());
5 string strValue;
6 Objson= CJsonObject(str);
7 cout << "-------------------------------------------------------------------" << std::endl;}
1 //保存JSON文件
2 __declspec(dllexport) void __stdcall write_string_to_file_append(char* file_string)
3 {
4 /*remove(file_string);*/
5 std::ofstream OsWrite(file_string, std::ofstream::trunc);
6 OsWrite << Objson.ToString();
7 OsWrite << std::endl;
8 OsWrite.close();
9 std::cout << "------------------执行完毕------------------------" << std::endl;
10 }
1.修改如下图数据结构:
1 __declspec(dllexport) void __stdcall FxmWindDirectBaseLine(int num, int count, char** pArr, int* sArr, int* iArr)
2 {
3
4 string iValue;
5 for (int i = 0; i < Objson["WindDirectLine"]["coordinates"][num]["mWindDirectBaseLine"].GetArraySize(); i++)
6 {
7 Objson["WindDirectLine"]["coordinates"][num]["mWindDirectBaseLine"].Delete(i);
8 i--;
9 }
10 cout << "---------------" << endl;
11 cout << Objson["WindDirectLine"]["coordinates"][num]["mWindDirectBaseLine"].GetArraySize() << endl;
12 CJsonObject je;
13