Reading file into array
I have these a file in a c program w开发者_运维知识库hich 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.
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
精彩评论