Results 1 to 4 of 4

Thread: Parsing of Text files in Qt

  1. #1
    Join Date
    Mar 2006
    Posts
    9
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Post Parsing of Text files in Qt

    Hi guys,

    I want to parse a text file in Qt. Can anybody give me some suggestions, how to proceed? I mean some good technichs....

    Thanks in advance.

    Regards,
    Shail.

  2. #2
    Join Date
    Feb 2006
    Location
    Roma ( Italy )
    Posts
    7
    Thanks
    3
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Question Re: Parsing of Text files in Qt

    Hi,
    Can you give more information?
    Your file is a ascii file or xml file? Is a Configuration or input/output file?
    If the file is a ascii file You can use a c++ command.
    If the file is a xml file You can use QtDom and QtSax class

    sorry for my english

    bye

  3. #3
    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: Parsing of Text files in Qt

    What kind of text file is that?

    - For XML files, see QtXml module. (DOM -> QDomDocument, SAX -> QXmlSimpleReader)
    - For classic INI files, see QSettings and this thread.
    J-P Nurmi

  4. #4
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Parsing of Text files in Qt

    homemade file formats will bring more complication : you'll have to craft a routine to translate ASCII or binary data to program-readable data. This is achieved by operating with QIODevice(s) such as QTextStream and the on the data the read in file, either line by line or everything at the same time.

    If you're curious enough have a look at the project parser in DevQt : converts a *.pro into a complex data structures that take care of scopes, variables and operators.
    Current Qt projects : QCodeEdit, RotiDeCode

Similar Threads

  1. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 09:49
  2. Access violation when reading big text files
    By robertson1 in forum General Programming
    Replies: 0
    Last Post: 18th September 2008, 06:59
  3. problem with reading text files
    By Axsis in forum Newbie
    Replies: 1
    Last Post: 25th April 2008, 12:29
  4. Handling mac text format files - support?
    By bnilsson in forum Qt Programming
    Replies: 0
    Last Post: 29th March 2008, 12:10
  5. how to save sequences of text files and sound files
    By nagpalma in forum Qt Programming
    Replies: 8
    Last Post: 3rd July 2007, 00:06

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.