Results 1 to 5 of 5

Thread: QFile - file read parts of the buffer

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2009
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question QFile - file read parts of the buffer



    All greetings! I would be very grateful if someone show you in my question ...

    I am writing a program backup file, it already works, but only with small files.

    To work with large files, you must read fail parts, but not completely, that would not take much memory...

    Qt Code:
    1. ...
    2. QFile fileRead(filename);
    3.  
    4. const int pageSize = getpagesize();
    5. const int fileSize = fileRead.size();
    6.  
    7. int parts = fileSize/pageSize;
    8. if (fileSize%pageSize != 0)
    9. parts++;
    10.  
    11. buffer = new char[pageSize];
    12.  
    13. for (int partsCount = 0; partsCount < parts; partsCount++) {
    14. //fileRead.read(buffer, fileSize); // ???
    15. ...
    To copy to clipboard, switch view to plain text mode 
    Last edited by eugen_Qt; 7th November 2009 at 22:16.

Similar Threads

  1. Replies: 5
    Last Post: 27th May 2009, 12:49
  2. Read binary from file
    By weldpua2008 in forum Newbie
    Replies: 2
    Last Post: 3rd April 2009, 23:50
  3. QFile can't read a file
    By Raccoon29 in forum Qt Programming
    Replies: 3
    Last Post: 11th February 2009, 20:24
  4. [Java] read and write a file
    By mickey in forum General Programming
    Replies: 3
    Last Post: 22nd June 2008, 10:43
  5. How to read text only as it is from file
    By thomasjoy in forum Qt Programming
    Replies: 3
    Last Post: 9th August 2007, 08:47

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.