infile wont read second time

Hi

I have this code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
infile.getline(Firstname,size,'\n');
	infile>>Lastname;

        strcpy_s(CheckSentinal, Firstname); 
        strcat (CheckSentinal," ");	
        strcat ( CheckSentinal , Lastname );
	cout<< CheckSentinal<<endl;
	    
	

		for (int j=0;j<4;j++)
		{
			infile>>test_scores[b][j];
			cout<<test_scores[b][j]<<" ";
		}
		cout<<endl;
                infile.getline(Firstname,size);
		infile>>Lastname;
		cout<<Lastname<<endl;
		cout<<Firstname<<endl;
		strcpy_s(CheckSentinal,Firstname); 
        strcat (CheckSentinal," ");	
        strcat ( CheckSentinal,Lastname);
		cout<<CheckSentinal<<endl;


when im trying to read into Last name the second value it wont read it instead it read spaces

this is what it suppose to read from the file

George        
Washington    
96.8 99.9 97.7 95.6
John          
Adams        


and instead it prints
George        Washington
96.8 99.9 97.7 95.6
John          


what can I do to fix this please help me

Regards
Maor
Topic archived. No new replies allowed.