+ 1
How to make a programm know its the first time opening it? (c++)
I'm new to C++ programming and I started to make a programm. But how can I save things and make my programm know it's the first time using it 2nd etc.
2 Respuestas
+ 3
There are many ways of going about that. If you're wanting it to check if its the first time ran so you can do some initial setup/configuration, but you don't want it to do it after the initial setup, then you could easily store a key/value in the OS registry for that. You can accomplish something similar by storing it into a config file that you store in the program's folder. Basically, you'll just want to push the data to something external of the program, such as the registry, text files, database, etc... etc.. etc.. The external source will keep track and then you'll just check that source when the program opens.
http://www.dreamincode.net/forums/topic/171917-how-to-setread-registry-key-in-c/
https://msdn.microsoft.com/en-us/library/bwt6b955.aspx
^Just a couple resources on accessing the registry. Plenty of examples out there in the internetz for all of the above. Hope that helps.
+ 5
You can write in a file the number of running the program and update it every time you run it again. In android there is a nice feature called shared preferences which can be used for this purpose.