-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Error using json.dump(); #1081
Copy link
Copy link
Closed
Description
I'm using visual studio and I got this error. on the xutility file
Exception thrown: write access violation.
this was 0xAFE3D714.I'm doing a "C" compatible DLL in C++. Here is the code:
#define gmx extern "C" __declspec(dllexport)
using json = nlohmann::json;
static json jsonDoc;
gmx double read(char* path) {
try
{
ifstream jsonFile(path);
jsonFile >> jsonDoc;
}
catch (const std::exception& error)
{
cout << error.what() << endl;
}
return 0;
}
gmx string getJsonFile() {
return jsonDoc.dump();
}Then I implement it like this.
_read(file);
string output = _getJsonFile();
cout << output.c_str();I don't know what I doing wrong. I hope someone can help me.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
