ifstream inside a while

PLS HELP ME... IS THIS CORRECT.. IT IS POSSIBLE

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
  void traverse(void){
			node*temp=new node;
			temp=head;
			while(temp!=NULL)
			{
				string lines;
				ifstream kimss("ALLTRANSACTIONS.txt");
				if (kimss.is_open())
				{
				while ( kimss.good() )
				{
				getline(kimss,lines);
				cout << lines << endl;
				}
				kims.close();
				}
				temp=temp->next;
			}
			return;
		}
Don't loop on .eof() or .good(), always loop on the input operation:

while(getline(kimss,lines))
Topic archived. No new replies allowed.