Reputation: 21
I am new in C++ world and I`m trying to wrote an app which needs some properties (JSON file). I managed to parse the json and build the app. The problem is that I need to pun that json file in the same folder with the builded app so I can read it. How can I "inject" that JSON file in the build.
Now, I`m doing something like this to get the JSON file.
const char *Config::defaultConfigName()
{
return "config.json";
}
I put that JSON in "Source File", in project. What path should I give in order to get that "config.json" from the project? Or what will be the best solution for this?
Thank you!
Upvotes: 1
Views: 2410
Reputation: 21
I managed to put the JSON text in source code:
const char *Config::defaultConfigName()
{
char const *json= R"config({
"key": "value"
})config";
return json;
}
Upvotes: 1