Why does getline() reads only the first line multiple times ? I also tried using getline() within the while loop but it gives the same result.Any specific reason why this is happening ?
void closestPair(char inFile[50],char outFile[50])
{
    int num1,num2;
    int i =0;
    string line ="";
    stringstream ss;
    ifstream fp(inFile);    
    while(!fp.eof())
    {
        getline(fp,line);
        ss<<line;
        ss>>num1>>num2;
        A[i].x = num1;
        A[i].y = num2;
        i++;
        printf(" %d %d \n", num1, num2);
    }
fp.close();
} 
my input file:
1 3
4 6
7 9
8 5
2 5
output: 1 3 1 3 1 3 1 3 1 3
 
    