Results 1 to 2 of 2

Thread: how to parse a text file in Qt C++ for Nokia Devices?

  1. #1
    Join Date
    Jul 2012
    Posts
    21
    Thanks
    2
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Question how to parse a text file in Qt C++ for Nokia Devices?

    Hi All,

    I do not know parsing. I need help to parse some text files. These text files are present on server. I need to parse them to pop some message according to the user selection.

    The pattern is like follows:

    The below quoted text represents one of the text files on the server.
    How do you discover your real purpose in life? I’m not talking about your job, your daily responsibilities, or even your long-term goals. I mean the real reason why you’re here at all — the very reason you exist. (option-1)

    Perhaps you’re a rather nihilistic person who doesn’t believe you have a purpose and that life has no meaning. Doesn’t matter. Not believing that you have a purpose won’t prevent you from discovering it, just as a lack of belief in gravity won’t prevent you from tripping. All that a lack of belief will do is make it take longer, so if you’re one of those people, just change the number 20 in the title of this blog entry to 40 (or 60 if you’re really stubborn). Most likely though if you don’t believe you have a purpose, then you probably won’t believe what I’m saying anyway, but even so, what’s the risk of investing an hour just in case? (option-2)

    Here’s a story about Bruce Lee which sets the stage for this little exercise. A master martial artist asked Bruce to teach him everything Bruce knew about martial arts. Bruce held up two cups, both filled with liquid. “The first cup,” said Bruce, “represents all of your knowledge about martial arts. The second cup represents all of my knowledge about martial arts. If you want to fill your cup with my knowledge, you must first empty your cup of your knowledge". (option-3)

    If you want to discover your true purpose in life, you must first empty your mind of all the false purposes you’ve been taught (including the idea that you may have no purpose at all). (option-4)

    So how to discover your purpose in life? While there are many ways to do this, some of them fairly involved, here is one of the simplest that anyone can do. The more open you are to this process, and the more you expect it to work, the faster it will work for you. But not being open to it or having doubts about it or thinking it’s an entirely idiotic and meaningless waste of time won’t prevent it from working as long as you stick with it — again, it will just take longer to converge. (option-5)
    Here we have 5 options for user. User selects the respective options and get the respective paragraph from the above text file.
    After each paragraph there is a blank line to distinguish between the messages of two different option.

    Anyone there who can help me on this ground?

    Thank you all in advance.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: how to parse a text file in Qt C++ for Nokia Devices?

    What have you tried? Just reading the QFile documentation gives you the skeleton, and checking for empty (or all blank) lines is a trivial QString or QRegExp exercise.

Similar Threads

  1. Parse Text File with Qt
    By rhf417 in forum Qt Programming
    Replies: 12
    Last Post: 26th June 2013, 04:47
  2. Replies: 0
    Last Post: 13th April 2012, 14:45
  3. Open positions@Nokia Maemo Devices
    By Kristiina in forum Jobs
    Replies: 0
    Last Post: 10th March 2010, 10:09
  4. Replies: 13
    Last Post: 21st June 2006, 22:22

Tags for this Thread

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.