ifstream fin("integers1.txt");//open a file
if (fin >> left[lpos++] >> right[rpos++]) //try reading things from it
if (fin >> left[lpos++] >> right[rpos++]) //if succeeded, try reading more
if (fin >> left[lpos++] >> right[rpos++])
... //repeat until failure
operator >> sort of returns 0 when an error (such as end of file) occurs.
The final fin will have incremented rpos and lpos to now be indices one past the end of right and left respectively. By decrementing them they now index the last integer added to the arrays.