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.
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.
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
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
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
Bookmarks