I have a problem trying to read a file with comma numbers, I want to have a function that creates arrays of integers (not knowing how many parameters the array has at the beginning) in a file like this:
1,0,3,4,5,2
3,4,2,7,4,10
1,3,0,0,1,2
etc. The result I want is something like
int v[]={1,0,3,4,5,2}
for each line of the file (obviously with values ββin each line), so I can add this array to the matrix. I tried to use fscanf, but I can not get it to stop at the end of each line. I also tried fgets, strtok and many other suggestions that I found on the Internet, but I do not know how to do this!
I am using Eclipse Indigo on a 32-bit machine.
PL-RL source
share