Make array of ints from numbers in txt file.

Jun 30, 2015 at 1:27am
I have a text file like this:
1, 3, 6, 6,
5, 1, 6, 8,
4, 6, 6, 7


I wanted C++ to read the file and put the numbers into an array of integers. The amount of numbers in the text file could also change, so it would have to be dynamic. The array would also then later be read in order. Is there any way to do this?
Last edited on Jun 30, 2015 at 1:28am
Jun 30, 2015 at 4:29am
closed account (NUj6URfi)
Scan for the number of commas, add 1, create an array that big, read in from file to a string and separate that with a ", " delimiter. Create a for loop to output. <- This can probably be simplified immensely, and I didn't use vectors due to the specification of arrays.
Topic archived. No new replies allowed.