[英]QFileInfo owner & group are empty
这是我的位置:
void MainWindow::writeOnFile(const QString &path)
{
// Get info files :
QFileInfo fileInfo(path);
QString name = fileInfo.fileName();
QString lastModif = fileInfo.lastModified().toString();
QString owner = fileInfo.owner();
QString group = fileInfo.group();
QString lastRead = fileInfo.lastRead().toString();
QString created = fileInfo.created().toString();
// Write on Logs :
QString filename = "C:\\Users\\Sherlock\\Desktop\\logs.txt";
QFile file ( filename );
if ( file.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text) )
{
QTextStream stream( &file );
stream << "The file " << name
<< " was first created on " << created
<< ", was last read on " << lastRead
<< " and was last modified on " << lastModif
<< ". The owner is " << owner
<< ". The group is " << group
<< endl;
}
}
这是我的输出:
文件younes.txt最初是在lun上创建的。 août17 19:40:34 2015,最后一次阅读lun。 août17 19:40:34 2015年,最后一次修改是在3月。 août18 00:21:512015。所有者是。 该组是
如您所见, 所有者和组未显示。
我做错什么了吗 ?
在Windows上,将返回一个空字符串。
因此,有文献证明group()
就是这种方式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.