I have written a function to read from .txt file and build a linked list, but the function missed the first line of the file. Anyone have any idea why that happens?
output:
//empty line  
gmail  
San Francisco  
123456
.txt file
person1
gmail
San Francisco
123456
readFile function
void list::readFile(std::string fileName){
    fstream fs;
    string dummy = "";
    string firstline;
    record * previous = new record;
    record * temp = new record;
    int recordCount = 0;
    fs.open(fileName, ios::in | ios::binary);
        do{
            std::getline(fs, temp->name);
            std::getline(fs, temp->email);
            std::getline(fs, temp->address);
            fs >> temp->phoneNo;
            std::getline(fs, dummy);
            recordCount++;
            if(head == NULL){
                head = temp;
                previous = temp;
                tail = temp;
            } else {
                previous->next = temp;
                previous = temp;
                tail = temp;
            }
        } while(!fs.eof());
    // } else {
    //     cout << "there's no record in the file yet." << endl;
    // }
    cout << head->name << endl;
    cout << head->address <<endl;
    cout << head->email << endl;
    cout << head->phoneNo << endl;
}
 
     
    