Reading from a file with different no of columns

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Bytes21
    New Member
    • Jun 2010
    • 5

    Reading from a file with different no of columns

    My file contains a series of numbers (integer, float, integer, float ....), each written on a separate line. The numbers of columns are different from one line to another i.e.
    77 2.45 3 1.75
    5 3.45 7 2.55 9 3.25
    6 1.75 4 3.55 6 2.55 9 2.45
    The program should read the first line, and return an array with its corresponding value. i.e. myarr[77] =2.45
    myarr[3]=1.75.
    then read the rest of the lines in the file the same way.
    Any input would help greatly :)
Working...