Erase text in a line before a certain character

Hi,
I just started using C++ and I've been trying to write a program to erase all texts in a line before the character ">". there is multiple lines and the information is saved on a .txt file.
I dont expect someone to do this for me entirely, but can someone help me get started or tell me how the script should be written?
Any help is appreciated,
Thanks :)
Here is a handy link for fstream use of text files: http://www.cplusplus.com/reference/iostream/fstream/

It gives you a list of functions, along with their descriptions and a piece of example code. That should get you started on the right way.
thank you for this. I looked at it and ive been making some progress.
one thing i cannot figure out tho. how do i tell the program to erase everything in each line until and including characters: "/>

sorry for the nooby questions :S
You might want to look at std::getline(). You can use that to read everything on a line up to a specific character:
1
2
3
4
5
6
7
8
9
#include <string>
#include <fstream>

std::ifstream ifs("input.txt");

std::string line;
std::getline(ifs, line, '>'); // read up to '>' on first line of file

std::getline(ifs, line); // now read in rest of line after '>' character. 
I just started using C++ and I've been trying to write a program to erase all texts in a line before the character ">". there is multiple lines and the information is saved on a .txt file.


I would say use shell script or Perl to do it. They are created for such purposes ;)
Topic archived. No new replies allowed.