head = new acmetype;//creating first node
fin>>head->pid;
currptr = head;//curr ptr pointing at head and first node is ready.
counter++;
while(fin){
nnptr= new acmetype;
fin>>nnptr->pid;
fin.getline(description, 25);
// fin.getline(acmetype.description[25]);
currptr->link = nnptr;
currptr = currptr->link;
if(fin.peek()=='\n')fin.ignore();//check for next character
counter++;
}//end of while
currptr->link= NULL;
currptr= NULL;
nnptr= NULL;
}//end of inputfn
//****************************************************************************
void printfn(acmetype *&head){
acmetype *currptr;
//print all data members
currptr = head;
while(currptr!=NULL){
cout<<currptr->pid<<endl;
currptr=currptr->link;
if(fin.peek()=='\n')fin.ignore();
}//end of while
All you are doing is reading the pid field and nothing else. The second
time you attempt to read the file (ie, the first time through your while loop)
you are attempting to read the word "jack" into an int. Since "jack" is not
a valid integer, this causes the input stream to go into an error state.
You need to read all of the fields on the first line before you can read
the pid of the second item.