hi :
why i use the following code always get the null file name:
#include <QDir>
#include <stdio.h>
int main(int argc, char *argv[])
{
dir.
setFilter(QDir::Files |
QDir::Hidden |
QDir::NoSymLinks);
dir.
setSorting(QDir::Size |
QDir::Reversed);
QFileInfoList list = dir.entryInfoList();
printf(" Bytes Filename\n");
for (int i = 0; i < list.size(); i++) {
printf("%10li %s\n", fileInfo.size(), qPrintable(fileInfo.fileName()));
}
return 0;
}
#include <QDir>
#include <stdio.h>
int main(int argc, char *argv[])
{
QDir dir;
dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
dir.setSorting(QDir::Size | QDir::Reversed);
QFileInfoList list = dir.entryInfoList();
printf(" Bytes Filename\n");
for (int i = 0; i < list.size(); i++) {
QFileInfo fileInfo = list.at(i);
printf("%10li %s\n", fileInfo.size(), qPrintable(fileInfo.fileName()));
}
return 0;
}
To copy to clipboard, switch view to plain text mode
please help,thanks
Bookmarks