我使用 QTextStreamer 读取 QFile 使用
if(file.open(QIODevice::ReadOnly | QIODevice::Text))
{
QTextStream stream(&file);
line = stream.readLine();
//...
但在我的要求中,我只需要从我的文件中读取特定的行集。例如:如果文件包含 1034 行。用户只能从第 107 行到第 300 行中选择要读取并显示在文本框中。
如何调整 qtextStream 阅读器的位置以指向文件的特定行。
现在我实施为
int count = 4;
while(count > 0)
{
line = stream.readLine();
count--;
}
line = stream.readLine();