As the title suggests, I'd like some help with parsing scenario files.
I know how to use sscanf() to read a known # of variables off a line, but how would I go about adapting it to an unknown number of variables?
The context is as follows. I currently have a std::map container that is used to store all of my spacecraft's panel elements using their active area ids. The save function generates a string of number pairs that contain the id and state of each panel element currently declared. Because the string gets longer or shorter depending on the number of elements declared I have to keep going back and modifying ParseScenarioLine() function each time an element is added or commented out which is both annoying and time consuming.
I I'd like to be able to write the "ParseScenarioLine()" function once rather having to modify it each time a panel element is added or removed but I'm not sure how.
I know how to use sscanf() to read a known # of variables off a line, but how would I go about adapting it to an unknown number of variables?
The context is as follows. I currently have a std::map container that is used to store all of my spacecraft's panel elements using their active area ids. The save function generates a string of number pairs that contain the id and state of each panel element currently declared. Because the string gets longer or shorter depending on the number of elements declared I have to keep going back and modifying ParseScenarioLine() function each time an element is added or commented out which is both annoying and time consuming.
I I'd like to be able to write the "ParseScenarioLine()" function once rather having to modify it each time a panel element is added or removed but I'm not sure how.
Last edited: