tags:

views:

50

answers:

1

Hello,

I have these a file in a c program which consist of a string and 4 doubles and 2 integer in one line and there is a total of 28 lines, i want to read this file and load the data into an array. can someone help me solve this.

+1  A: 

Split up your problem into sub-tasks:

  • Open the file using fopen
  • Allocate a buffer (array) to store the doubles
  • Create a loop while there is more to read
  • read in a single double into the array
  • Go to the next iteration
Brian R. Bondy