I want array to not read first integer

So I have a file names sortme that reads:
5
d
99
0
3
45
2

I want to read this file to an array:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
void readftoa(int x[], int &n)
{
   fstream input;
   input.open("sortme.txt")
   
   int i =0;
   input >> x[i];
   while (!input.eof())
   {
     i++;
     input >> x[i];
   }
   n=i;
   input.close();
}


In this file, 5 is the number of elements, d stands for descending, and the rest of the 5 numbers is what i want to put in my array. When i do this, it adds the number of elements, 5, to my array, I'm guessing because it's type int as well. How do i get it to not read that into the array?

Please, do not double post. It clutters forums and spreads attempts to help you. Another thread: http://www.cplusplus.com/forum/beginner/147641/
Topic archived. No new replies allowed.