1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
#include <string> #include <sstream> #include <iostream> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { const char* p = "aaa\nbbb\r\nccc\n\nddd\n"; std::stringstream is(p); string t; while(getline(is, t)) { t.erase(t.find_last_not_of("\r")+1); cout << t << endl; } return 0; } |