I want to save my app setting like this example:
[Properties]
ShowGeneralTab = 1
ShowFanTab = 1
ShowMonitoringTab = 1
ShowOnScreenDisplayTab = 1
ShowScreenCaptureTab = 1
ShowVideoCaptureTab = 1
ShowProfilesTab = 1
ShowUserInterfaceTab = 1
(got it from msiafterburner :|)
can anyone tell me how i can read it? like whenever i want to see the value of ShowGeneralTab what should i do? I already read the file tutorial on this site + tutorialspoint and still don't understand how i should do it, can anyone help me?!
hints, anything or just simply a code so i can think on it ?! :)
Hi, I don't know if there are already some libraries or other tools that do this, but you could write your own implementation: you read a line from the file and split it in two: the name of the property before the "=" and the value after the "=". Then you can check against the name of the property until you find the one you are looking for.
thanks minomics, i thought about that, but my main problem is not understanding what to do in c++ ! i can write pesudo code but can't turn it into c++ code :| ''
smacs thats goot options for struct/classes, i can turn mine into a struct of settings ! but what if i wanted to save like 6 structs, should i make 6 files?! can't i just put them in the same place?!
but i still would ike to know how to do the it the minomics way :) + i didn't know that i can just write a class too a file like that !
i don't want to sound like a lazy guy but i really don't know how to do that, im really bad with strings:) i know i can check line by line, but not sure how i can only check the first part and not the = 1 , maybe i can do seekg -3 back?! and do forward again ! is that a good way?
yes i edited it, i didn't see it :)! + i didn't know getline can do that !
im super-super tired today, will do it tomorrow, but i can see how i should do that, i just simply get the line from file :) getline does the rest for me :)
it starts from middle of my file and goes back to beginning and goes till end and stops, why does it get to middle first? i tried seekg(0) ! no difference!