qt - How to make a QString from a QTextStream? -
will work?
qstring bozo; qfile filevar("sometextfile.txt"); qtextstream in(&filevar); while(!in.atend()) { qstring line = in.readline(); bozo = bozo + line; } filevar.close();
will bozo entirety of sometextfile.txt?
why read line line? optimize little more , reduce unnecessary re-allocations of string add lines it:
qfile file(filename); if (!file.open(qiodevice::readonly | qiodevice::text)) return; qtextstream in(&file); qstring text; text = in.readall(); file.close();
Comments
Post a Comment