I have a class called "Type". In class type I have string name, string weakness[], string resistance[], string immunity[]. I have a file with the format:
Name=type1
Weaknesses=weak1, weak2, etc
Resistances=resist1, resist2, etc
Immunities=immune1, etc
I'm not sure what is the easiest/most efficient way to read and store the data from this though. I can't read the file line by line because I'm not sure how many strings there are going to be. I'm also not sure how to ignore the "=" signs and the ","s.
Is there a way to read the strings between "Name=" and "Weaknesses=" and so forth, so I can store the values in the correct members. I'm sorry if this is unclear, I tried to explain it as best as I could.
You need to use one of the standard containers rather than trying to deal with arrays directly. Plus [] isn't really what you think it means, it's an incomplete specification.
If you're not sure what container to use, we tend to use vector as the default. So vector<string> weakness, vector<string> resistance, vector<string> immunity is what you'll have.
Containers are cool. You can add and remove things at runtime and query their size.
You're going to spend a bit of time parsing the input, but the code for that will be associated with Type as in: