Results 1 to 2 of 2

Thread: Read files with strings and doubles

  1. #1
    Join Date
    Nov 2006
    Posts
    14
    Thanks
    1

    Default Read files with strings and doubles

    Hi everyone,
    I want to open ASCII files in qt3 and display and do some computation with the numbers, but it happens that some files contain some text and I could not find a way to avoid reading these characters. How can I ask my code to read doubles only, as it always crashes once the characters are passed to my functions.
    Thanks for any help
    Last edited by thebra; 18th January 2007 at 20:39. Reason: spelling error

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

    Default Re: Read files with strings and doubles

    I'd read a token one at a time using QTextStream and check if each token read is a real number. If it's not, simply ignore it and read on.

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.