superwick
asked on
inputting from txt file into an array
Hi I'm a total beginner to C and i'm just looking for some code that will take in data from a txt file (for ex: a list of numbers separated by spaces) and put them into an array
thanks...
thanks...
ASKER
All those pages just really confused me... sorry I'm a total beginner in C
If I have a txt file with contents :
2 5 7 8 10
how can i get those numbers into an array so for example array[0] is 2, array[1] is 5, array[2] is 7, etc?
Please, I would really appreciate some example code for this..
If I have a txt file with contents :
2 5 7 8 10
how can i get those numbers into an array so for example array[0] is 2, array[1] is 5, array[2] is 7, etc?
Please, I would really appreciate some example code for this..
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
https://www.experts-exchange.com/questions/21722375/Parsing-CSV-File.html
https://www.experts-exchange.com/questions/21417831/Parse-a-CSV-File.html
https://www.experts-exchange.com/questions/20407343/How-to-read-a-cvs-file.html
there are different approaches to read and parse the file (the same if separated by comma or by spaces), have a look to all the discussions there.