Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/144.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 打开QFile进行附加_C++_File_Qt_Qfile - Fatal编程技术网

C++ 打开QFile进行附加

C++ 打开QFile进行附加,c++,file,qt,qfile,C++,File,Qt,Qfile,如何打开QFile进行追加,即相当于 FILE *f = fopen("myfile.txt", "a"); 在QIODevice::Append模式下打开文件: QFile f(...); if (f.open(QIODevice::WriteOnly | QIODevice::Append)) { ... } 另请参阅。Qt文档有误导性:“模式必须是QIODevice::ReadOnly、QIODevice::WriteOnly或QIODevice::ReadWrite。它还可能有其

如何打开QFile进行追加,即相当于

FILE *f = fopen("myfile.txt", "a");

QIODevice::Append
模式下打开文件:

QFile f(...);
if (f.open(QIODevice::WriteOnly | QIODevice::Append)) {
  ...
}

另请参阅。

Qt文档有误导性:“模式必须是QIODevice::ReadOnly、QIODevice::WriteOnly或QIODevice::ReadWrite。它还可能有其他标志,如QIODevice::Text和QIODevice::Unbuffered。”QIODevice文档提到了附加标志,但仅从QFile文档中看不明显。