Results 1 to 10 of 10

Thread: QFile open question

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2010
    Posts
    8
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QFile open question

    hi, everyone,
    i have a question to ask you. it's about QFile. my code is:
    Qt Code:
    1. QFile file("/proc/mounts");
    2. if (!file.exists())
    3. {
    4. qDebug() << "exist error" << file.error();
    5. file.close();
    6. return 0;
    7. }
    8.  
    9. if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
    10. {
    11. qDebug() << "open error" << file.error();
    12. file.close();
    13. return 0;
    14. }
    15. .......
    16. file.close();
    To copy to clipboard, switch view to plain text mode 
    when i open the file some times, and then it printf "open error 4" ,4 means QFile::ResourceError,what's the problem.
    thanks!
    Last edited by wysota; 27th March 2010 at 14:02. Reason: Missing [code] tags

Similar Threads

  1. QFile::open throws std::bad_alloc for no obvious reason
    By nateriver in forum Qt Programming
    Replies: 3
    Last Post: 29th December 2009, 06:10
  2. possible open/write two files same time with QFile
    By npotency in forum Qt Programming
    Replies: 4
    Last Post: 15th November 2009, 00:28
  3. Qfile question
    By dreamer in forum Qt Programming
    Replies: 1
    Last Post: 3rd May 2008, 15:32
  4. QFile Problem~ "Unknow error" in "open(QIODevice::ReadWrite)"
    By fengtian.we in forum Qt Programming
    Replies: 3
    Last Post: 23rd May 2007, 15:58
  5. QFile::writeBlock: File not open
    By safknw in forum Qt Tools
    Replies: 1
    Last Post: 16th September 2006, 13:21

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
  •  
Qt is a trademark of The Qt Company.