I am my wits end

The space at the end of some employee ID is killing me.. Can someone teach how can i exclude them?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
ifstream infile ;
	infile.open("UEMPLOYEE.DAT",ios::in) ;
	if (infile.fail())
	{
		cerr << "The UEMPLOYEE file does not exist" ;
		system("pause") ;
		exit(1) ;
	}
	ofstream outfile ;
	outfile.open("EXTRA.dat",ios::app) ;
	if (outfile.fail())
	{
		cerr << "Storage does not has enough space!!" ;
		system("pause") ;
		exit(1) ;
	}



	infile.get(Department,7) ;
	infile >> NumberofEmployee ;
	infile.ignore(20,'\n') ;
	for(int i =0 ; i<NumberofEmployee ; i ++) 
	{
			infile.get(temp2[i],7) ;
			infile.ignore(80,'\n') ;
			for (int k = 0 ; k<6 ; k++)
				{
					int z = 0 ;
					if (temp2[i][k] == ' ')
					{
						ifstream in ;
						in.open("UEMPLOYEE.DAT",ios::in) ;
					
						while(z!=(i+1)) 
						{
							in.ignore(100,'\n') ;
							z++;
						}
						in.get(temp2[i],k+1) ;
						cout << temp2[i] ;
					}
				}
			strcpy(temp[i],temp2[i]);
	}


"UEMPLOYEE.DAT"
MAN4E23
A34889Tan Beng Soo 7789456S0 0 1000
Z23669Tan Chee Y ong 5668877S0 0 2000
D2345 Shiva Kumar 3744552H5 4 20
D231 Krishna Barika 1567304H6 5 10
Topic archived. No new replies allowed.