Qt file size limit -
i know how read | write | open files in qt. trying achieve this; how create new file when existing file exceeds 'x' size? instance, have 100kb file size, before writing same file, check size, if size exceed 100kb, create new 1 (not removing existing one), chmod if needed, keep on writing.
i tried this:
qstring filename("w:/file.txt"); qfile file(filename); qfileinfo info(file); int size = 0; if (file.open(qiodevice::readwrite | qiodevice::truncate)) { qtextstream stream(&file); while(size < 102400) { stream << "something" << endl; size += info.size(); } } qdebug() << info.size();
try qfileinfo::size() return file size in bytes.
Comments
Post a Comment