qt - read a text file to QStringList -


i have text file. need read qstringlist. there no line seperators. mean each line in text file in new line. there anyway can this?

i assume every line should separate string in list. use qtextstream::readline() in cycle , on each step append returned value qstringlist. this:

qstringlist stringlist; qfile textfile; //... (open file reading, etc.) qtextstream textstream(&textfile); while (true) {     qstring line = textstream.readline();     if (line.isnull())         break;     else         stringlist.append(line); } 

Comments

Popular posts from this blog

mod rewrite - Doing external redirect. .htaccess NS flag not working. How to achieve similar results? -

mysql - How to insert just year and month into date field? -