Results 1 to 18 of 18

Thread: Display contents of .txt file

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2009
    Posts
    151
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    6
    Thanked 13 Times in 11 Posts

    Default Re: Display contents of .txt file

    But you have to read the file twice. Good luck if the file is 4GB in size and contains about 50M lines.

    Reading the whole file into memory is out of the question as well.

    I am currently using a Windows PC, the search facility classes large files as 1 MB and huge as 5 MB. I doubt that there is any problem reading such a file into memory.

    On my system the txt files are typicay much smaller and this routine works well enough on them.

    I admit that the double pass is a small draw back but if you want a professional solution you can download the GNU code and adapt that.

    The source is at http://git.savannah.gnu.org/gitweb/?...3b;hb=0482f19. and it's a mere 1700 lines of code!
    Last edited by JD2000; 22nd January 2010 at 14:00.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Display contents of .txt file

    Quote Originally Posted by JD2000 View Post
    I am currently using a Windows PC, the search facility classes large files as 1 MB and huge as 5 MB. I doubt that there is any problem reading such a file into memory.
    The difference between 1MB and 4GB is 4000 times. And I believe on some filesystems you can have even larger files.

    On my system the txt files are typicay much smaller and this routine works well enough on them.
    But the thread author is not implementing a clone of your system. And your system works only because nobody tried passing a much larger file to it just yet. But eventually someone will, you will see.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 0
    Last Post: 9th April 2009, 06:35
  2. Application.app/Contents/MacOS file issue
    By sgmurphy19 in forum Qt Programming
    Replies: 1
    Last Post: 20th September 2008, 09:03
  3. how to display DGN file
    By Nithya in forum Qt Programming
    Replies: 8
    Last Post: 24th April 2008, 10:23
  4. Replies: 6
    Last Post: 9th January 2008, 15:56
  5. Replies: 4
    Last Post: 10th December 2006, 09:04

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.