C++ (Qt)QFile f("/home/user/file.txt")if (!open(f,QIODevice::WriteOnly)) {qDebug() << "error open file"}
QFileInfo fileInfo(file); QString newBaseName = zzz(fileInfo.baseName()); return fileInfo.path() + (fileInfo.path().isEmpty()? "": "/") + newBaseName + (fileInfo.completeSuffix().isEmpty()? "": ".") + fileInfo.completeSuffix();