__declspec(dllexport) Rootobject __stdcall RefRootobjectValues(char* path) { ifstream t(path); Rootobject Root; string str((istreambuf_iterator<char>(t)), istreambuf_iterator<char>()); CJsonObject Objson = CJsonObject(str); string strsss; Objson.Get("gridStartTime", strsss); Root.gridStartTime = ReturnCharArr(strsss); Objson.Get("gridEndTime", strsss); Root.gridEndTime = ReturnCharArr(strsss); Objson.Get("resultStartTime", strsss); Root.resultStartTime = ReturnCharArr(strsss); Objson.Get("resultEndTime", strsss); Root.resultEndTime = ReturnCharArr(strsss); Objson.Get("WindSpeedBorder", strsss); Root.WindSpeedBorder = ReturnCharArr(strsss); Objson.Get("WindDirectBorder", strsss); Root.WindDirectBorder = ReturnCharArr(strsss); Objson.Get("resultWindDirectGrid", strsss); Root.resultWindDirectGrid = ReturnCharArr(strsss); int nums = Objson["WindDirectLine"]["coordinates"].GetArraySize(); Root.WindDirectLine.coordinates = (struct Coordinate *)malloc(nums * sizeof(struct Coordinate)); /*Coordinate* coor=new Coordinate [nums];*/
/*由于School_T中定义的student是一个结构体指针,必须要对其进行分配内存*/
//Root.WindDirectLine->coordinates = (coordinates *)malloc(sizeof(Student_T));
for (int i = 0; i < nums; i++) { int mWindDirectBaseLine_Length = Objson["WindDirectLine"]["coordinates"][i]["mWindDirectBaseLine"].GetArraySize(); Root.WindDirectLine.coordinates[i].mWindDirectBaseLine = (struct Mwinddirectbaseline *)malloc(nums * sizeof(struct Mwinddirectbaseline)); for (int j = 0; j < mWindDirectBaseLine_Length; j++) { string Str1; Objson["WindDirectLine"]["coordinates"][i]["mWindDirectBaseLine"][j].Get("p", Str1); Root.WindDirectLine.coordinates[i].mWindDirectBaseLine[j].p = ReturnCharArr(Str1); Objson["WindDirectLine"]["coordin