Read from a delimiter in a file

1

You see, I'm reading an xml file where each entry has the following format:

<BatchIdentifier>[ID_FACTURA]</BatchIdentifier>

I capture each line in the file with:

string line;

while(getline(plantilla,line,'\n')){//PARA HACER LO MISMO CON CADA LINEA DEL FICHERO

    while() 
}

My question is how can I read from the bracket that opens and finish reading in the one that closes ?, if there is any function to start reading from a delimiter because obviously, what is at the beginning and at the end of that line are labels of xml , only interested in storing what is in between

Help is appreciated. Thanks

    
asked by AER 21.04.2018 в 13:40
source

1 answer

1
auto it    = std::find(line.begin(),line.end(),'>');
auto itEnd = std::find(it,line.end(),'<');
std::string factura(std::next(it,1),itEnd);

You can see it working here

    
answered by 23.04.2018 / 08:29
source