Afficher un message
Vieux 05/04/2008, 15h25   #1
barcaroller
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut getline() and newlines


I have a text file with mixed carriage returns ('\n' and '\r\n').

On Linux, both the std::string getline() global function and the
std::iostream getline() member function are keeping some of the newlines in
the result (I suspect they look only for the '\n').

* Is there a quick way I can tell either function to gobble up both
Windows-style and Unix-style newlines?

* If not, what would be an efficient way of getting rid of them? Currently
I use string::find_last_of("\n\r") + string::erase() but this is not very
efficient.



  Réponse avec citation
 
Page generated in 0,05011 seconds with 9 queries