Results 1 to 2 of 2

Thread: about QFileInfo

  1. #1
    Join Date
    Sep 2006
    Posts
    12
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default about QFileInfo

    hi :
    why i use the following code always get the null file name:

    Qt Code:
    1. #include <QDir>
    2.  
    3. #include <stdio.h>
    4.  
    5. int main(int argc, char *argv[])
    6. {
    7. QDir dir;
    8. dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
    9. dir.setSorting(QDir::Size | QDir::Reversed);
    10.  
    11. QFileInfoList list = dir.entryInfoList();
    12. printf(" Bytes Filename\n");
    13. for (int i = 0; i < list.size(); i++) {
    14. QFileInfo fileInfo = list.at(i);
    15. printf("%10li %s\n", fileInfo.size(), qPrintable(fileInfo.fileName()));
    16. }
    17. return 0;
    18. }
    To copy to clipboard, switch view to plain text mode 
    please help,thanks
    Last edited by e8johan; 19th October 2006 at 09:32. Reason: missing [code] tags

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: about QFileInfo

    What about:
    Qt Code:
    1. #include <QtDebug>
    2. ...
    3. qDebug() << fileInfo.size() << fileInfo.fileName();
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.