I'm not sure I quite understand what your problem is. What do you mean by "I can't get the file to stop reading?"
Are you asking you you can read just the one number?
If that is the case there are a couple things you can do. If you are using a file stream (the object oriented way to do it), then you can read the number like so:
Code:
int val1;
fstream >> val1;
Secondly, you can use the fscanf function, like so:
Code:
#include <stdio.h>
int i;
...
fscanf( fid, "%d", &i);
thsis is how you would do it in c, but it works in c++ as well.