ok here is an example of the type txt file I am trying to read
12345678901234567890123456789012345678901234567890
Bugs Bunny Jr. 1234 1001.01
Dr. Wiley Coyote 2345 1002.02
Taco Speedy Gonzales3456 1003.03
Billy the Goat 4567 1004.04
Porky Pig 5678 1005.05
what I am trying to do is skip the first line and then read the rest storing it in a linked list of structs the problem I am running into is that it will get all the way to the third line then skip the fourth read the fifth and get junk for the sixth.
here is the read function I am using all variables are global
void readfilefn()
{
firstcustomer=new customerType;
fin.ignore(50,'\n');
fin.get(firstcustomer->name, 21);
currcustomer=firstcustomer;
fin>>currcustomer->pin;
fin>>currcustomer->balance;
firstcustomer->link=currcustomer;
//check if the file is being read properly
cout<<"\nCustomer Name: "<<firstcustomer->name<<endl;
cout<<"Pin : "<<firstcustomer->pin<<endl;
cout<<"Balance : "<<firstcustomer->balance<<endl;
counter++;
while(!fin.eof()&&fin.peek()=='\n')
{
newcustomer=new customerType;
int row=0;
while(row<counter)
{
fin.ignore(50,'\n');
row++;
}
fin.get(newcustomer->name, 21);
fin>>newcustomer->pin;
fin>>newcustomer->balance;
currcustomer->link=newcustomer;
currcustomer=newcustomer;
cout<<"\nCustomer Name: "<<currcustomer->name<<endl;
cout<<"Pin : "<<currcustomer->pin<<endl;
cout<<"Balance : "<<currcustomer->balance<<endl;
//if(fin.peek()!='\n')fin.ignore();
counter++;
}//end of while
cout<<"There are "<<counter<<" accounts"<<endl;
}