Post more of your code, like the declarations for tmp and x (or the whole thing if it is small enough), and post the data in the input file, or at least enough to cause the error.
It appears that x is a char, which I didn't notice before, but on a quick examination I can't see why my code would not work. Your code is wrong because you ignore the value in x if (!inFile >> x) part succeeds. Maybe this makes more sense. If the input succeeds, continue, otherwise ignore the character. Of course, if x is a char, then this doesn't make as much sense, but my point is for you to understand that the inFile >> x part loads data into x if it succeeds, but not if it doesn't.
if (inFile >> x) // if the read succeeds
// process the value in x
tmp[i] = x;
// otherwise it is end of file or some other error.