【问题标题】:"QIODevice::write: device not open" when file is open文件打开时出现“QIODevice::write: device not open”
【发布时间】:2015-01-28 18:18:07
【问题描述】:

当我编译我的程序时,我收到错误消息“QIODevice::write: device not open”这个程序在我的旧计算机上运行,​​但由于某种原因它在我的新计算机上运行不正常。任何有关如何解决此错误的见解将不胜感激,谢谢。

file.open(QIODevice::Append);
file2.open(QIODevice::Append);

QTextStream stream(&file); //stream of information
QTextStream stream2(&file2);

//write to file
//code continued here, deleted to post here... stream << whatever, stream2 << whatever whatever...

//end stream
stream << endl;
stream2 << endl;

//close file
file.close();
file2.close();

【问题讨论】:

  • 有没有可能是文件没有打开?我的意思是没有权限在默认位置写。
  • 是的,我认为你的权利让我检查一下

标签: c++ qt


【解决方案1】:

问题是我在此计算机上不存在的位置创建文件更改了创建文件夹的位置并修复了它。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-10-27
    • 2017-05-28
    • 1970-01-01
    • 2022-06-29
    • 1970-01-01
    • 1970-01-01
    • 2021-08-06
    • 1970-01-01
    相关资源
    最近更新 更多