Reading file into dyn. array

Hi

Im having trouble with the syntax to store data from a file into a dynamic array, for example, if i had a data file with the following:

1 2 3 4 5

and wanted to read the numbers into a dynamic array, how would i do it? I think it should be something like:


1
2
3
4
5
6
7
8
9
10
11
12
ifstream fin;
fin.open("FILE.TXT");
int *array;
array = new int[????];        //what do i put here?
while (!FILE.eof())
{
for (int i=0;i<???;i++)
fin >>array[i];        //not sure what to put here
}


Topic archived. No new replies allowed.