Results 1 to 20 of 20

Thread: How to read a value from tow columns file !

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2015
    Posts
    9
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    9

    Default Re: How to read a value from tow columns file !

    hey..but as i wrote when i write list.at(0) i get just the first character (0) of the numer 0.724928 and when i write list.at(1) i get (.)

    do you have any idea why is that happening ?

    Regards

  2. #2
    Join Date
    Jun 2015
    Location
    India
    Posts
    185
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 14 Times in 14 Posts

    Default Re: How to read a value from tow columns file !

    This should not happend unless you have spces between numbers or else you might doing line.at(0) or line.at(1).
    show your code.
    Thanks :-)

  3. The following user says thank you to prasad_N for this useful post:

    mejacky (6th October 2015)

  4. #3
    Join Date
    Oct 2015
    Posts
    9
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    9

    Default Re: How to read a value from tow columns file !

    i think every chracter is being interpreted as a column or an element und not the whole number 0.724928.. so if i give list.at(15) i get 1 from the other number 0.0451153..

    so how could i solve the problem ?

  5. #4
    Join Date
    Jun 2015
    Location
    India
    Posts
    185
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 14 Times in 14 Posts

    Default Re: How to read a value from tow columns file !

    Show your splitting part of the code plz
    Thanks :-)

  6. The following user says thank you to prasad_N for this useful post:

    mejacky (6th October 2015)

  7. #5
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: How to read a value from tow columns file !

    Quote Originally Posted by mejacky View Post
    hey..but as i wrote when i write list.at(0) i get just the first character (0) of the numer 0.724928 and when i write list.at(1) i get (.)
    And as you wrote you get that when you are not using the space separator to split on.

    So prasad_N made a typo in an otherwise good answer. As a programmer you could have looked at the error, then figured that one of your two list.at() calls must be the problem, then checked which one and then fixed it after consulting the documentation.

    But instead you randomly changed something else, getting a totally different and for your purpose unusable result.

    One of the most important skills for a developer is to anaylize error situations.
    Asking for help for every minor problem is not viable in the long run.

    Cheers,
    _

  8. The following 2 users say thank you to anda_skoa for this useful post:

    mejacky (6th October 2015), prasad_N (4th October 2015)

  9. #6
    Join Date
    Oct 2015
    Posts
    9
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    9

    Default Re: How to read a value from tow columns file !

    Thank you a lot guys for your replys..i'm still getting the same Probleme, but I will keep trying until it works


    Best Regards

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

    Default Re: How to read a value from tow columns file !

    You have been given the solution for the by-character, rather than by-column, split. If you have done that change, that is replaced
    Qt Code:
    1. QStringList list = line.split("")
    2. // with
    3. QStringList list = line.split(" ")
    To copy to clipboard, switch view to plain text mode 
    , and the character between the columns is indeed a space (not a Tab) then you must be seeing a different problem. You are not to describing the new problem, and doing so would definitely help.

  11. The following user says thank you to ChrisW67 for this useful post:

    mejacky (6th October 2015)

Similar Threads

  1. Read contents from the file using QHTTP Read()?
    By Gokulnathvc in forum Newbie
    Replies: 2
    Last Post: 21st June 2011, 08:03
  2. Make a column read-only in a QSqlTableModel/QTableView
    By graciano in forum Qt Programming
    Replies: 0
    Last Post: 15th November 2009, 18:18
  3. read ascii files with different column counts
    By pospiech in forum Qt Programming
    Replies: 5
    Last Post: 6th November 2009, 12:42
  4. Replies: 6
    Last Post: 6th August 2009, 17:18
  5. Replies: 8
    Last Post: 28th May 2007, 20:32

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.