1
如果我想追加到可能存在或不存在的文件... 什麼是正確的代碼?Qt文件追加開放模式
if(!file.exists()){
mode= QIODevice::WriteOnly | QIODevice::Text;
}else{
mode= QIODevice::Append | QIODevice::Text;
}
if(!file_destino.open(mode)){
balblabla...
}
或者:
if(!file_destino.open(QIODevice::Append | QIODevice::Text)){
balblabla...
}
或者:
if(!file_destino.open(QIODevice::Append | QIODevice::WriteOnly | QIODevice::Text)){
balblabla...
}