How to write a undertemined size array to a txt file?

Hey guys, I'm doing a Text-based RPG game and it will include some checkpoints, on those checkpoints the game will save the progress, so I need to write all my variables to a text file and then read them all when the player loads the game.

Some of my variables, like enemyNames, dont have any determined size, they're like this: "int enemyNames[];"

So how do I write an array to a text file without determining a size?
And how do I read them when the player loads the game?

Thank you so much for your help.
Last edited on
┬┐how do you use it, if you don't know its size?
You need to give those arrays sizes. Just give them a size definitely larger than you are going to use. I also wonder, why are you giving your enemies integers for names?
it's just for the names and stuff like that, it's undertemined so i can add more names without having to change its size each time but, as i've seen here and in other forums, i need to definitely give them size...
as for the int for names, i was distracted, it's string ofc
i still don't know how to read the data from the text file and give those values to the differente variables, can anyone give me a hint?
Read about the standard library containers, such as std::vector.
Topic archived. No new replies allowed.