Asmsycool
Asmsycool

Reputation: 1

Reading file into array

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.

Upvotes: 0

Views: 264

Answers (1)

Brian R. Bondy
Brian R. Bondy

Reputation: 347586

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

Upvotes: 1

Related Questions