[Solved] How can I store a variable in another file?
[ad_1] You can use std::fstream: #include <fstream> #include <iostream> int myint; int main() { // when entering app: std::ifstream fs(“data.txt”); if ( fs ) { fs >> myint; } fs.close(); std::cout << myint; myint++; // when exiting app: std::ofstream fs2(“data.txt”); fs2 << myint; } 2 [ad_2] solved How can I store a variable in another … Read more