I have an ascii-file containing several lines of information.
the file looks something like this:
2345
an integer
line with text
9835
another integer
another line with some text
and so on
i first need to find the respective number (ex 9835), and then manipulate(in this case overwrite) some of the next lines of information.
For example in one case i want to overwrite only the line of text.
the problem for me is this: i cant figure out how to find the right number, and i dont know how to overwrite the correct line since the posts and lines are different lenghts.
how do i search, and how can i manipulate one spesific line when i dont know the size of the different "posts"?
you can use a fstream object, open the file and keep reading one line at a time and matching it if you need that line.
to read a line you can use getline(fstream, std::string);
it could be something like this: