SECOND ITEM READ TWICE

MY INPUT:
1200233 Jan 2013 3 UCCD1004 PROGRAMMING_CONCEPTS_AND_DESIGN 4 70 UCCD1024 DATA_STRUCTURES 4 80 UCCD2502 INTRODUCTION_TO_PROPOSAL_WRITING 3 78

1201237 May 2012 2 UCCD1024 DATA_STRUCTURES 4 80 UCCD2502 INTRODUCTION_TO_PROPOSAL_WRITING 3 81

1300899 Oct 2012 2 UCCD1004 PROGRAMMING_CONCEPTS_AND_DESIGN 4 70 UCCD1024 DATA_STRUCTURES 4 80

1200233 May 2012 1 UCCD2502 INTRODUCTION_TO_PROPOSAL_WRITING 3 70

1
2
3
4
5
6
7
8
9
10
11
12
13
14
  while(!infile.eof())
	{
		infile>>SID>>month>>year>>NoOfSubject;
		cout<<SID<<" "<<month<<" "<<year<<" "<<NoOfSubject;

		getline(infile,tmp);
		istringstream iss(tmp);
		while(!iss.eof())
		{
			iss>>Scode>>subject>>CreditHour>>marks;
			cout<<" "<<Scode<<" "<<subject<<" "<<CreditHour<<" "<<marks<<" ";
		}
		cout<<"\n\n";
	}



BUT IT DISPLAY LIKE THIS:

1200233 Jan 2013 3 UCCD1004 PROGRAMMING_CONCEPTS_AND_DESIGN 4 70 UCCD1024 DATA_STRUCTURES 4 80 UCCD2502 INTRODUCTION_TO_PROPOSAL_WRITING 3 78

1201237 May 2012 2 UCCD1024 DATA_STRUCTURES 4 80 UCCD2502 INTRODUCTION_TO_PROPOSAL_WRITING 3 81 UCCD2502 INTRODUCTION_TO_PROPOSAL_WRITING 3 81

1300899 Oct 2012 2 UCCD1004 PROGRAMMING_CONCEPTS_AND_DESIGN 4 70 UCCD1024 DATA_STRUCTURES 4 80

1200233 May 2012 1 UCCD2502 INTRODUCTION_TO_PROPOSAL_WRITING 3 70



PROBLEM: THE SECOND ITEM FROM ISTRINGSTREAM DISPLAY TWICE
PROBLEM: THE SECOND ITEM FROM ISTRINGSTREAM DISPLAY TWICE
Solution: Don't loop on eof.

http://stackoverflow.com/questions/5605125/why-is-iostreameof-inside-a-loop-condition-considered-wrong

Ok thank alot!!!
Topic archived. No new replies allowed.