Global variables are stored within the JSON file, how do I declare them as global variables when I read them out in my C++ program? #1476
Labels
kind: question
solution: proposed fix
a fix for the issue has been proposed and waits for confirmation
Dear Nlohmann,
Thanks so much for the library! It is relatively user friendly :)
I am working on a project, which I keep the variables in a JSON file, and intend to read them out into my C++ program. I can do that, but the problem is that these variables are actually global variables. By reading them out in my main function, these variables are essentially local to the main function. Which is not what I require. I am not sure how could I make these variables global, your help will be much appreciated!
int main() {
std::ifstream in("/LearnJSON/test2.json");
json file = json::parse(in);
}
The text was updated successfully, but these errors were encountered: