Delete new line from string
Hello.
I am reading lines from file and convert in wstring. But i want to remove the new line control character from wstring. How i can do that?
You could just read them with getline(). It automatically discards newlines.
getline i use ...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
void getParLines(const char * textFile1)
{
string textFile=textFile1;
ifstream file(textFile.c_str(),ios::binary);
string line;
wstring wline;
while (getline(file, line))
{
trim(line);
wline=UTF8_to_WChar(line.c_str());
if (wline.size()>0)
{
lines.push_back(wline);
}
}
}
| |
The file is in UTF8 forma, and the end of line have the CRLF controls.
Topic archived. No new replies allowed.