I am working on visual studio 2008 what i want to do is read till the end of the file the code i am using is

StreamReader ^sr= gcnew StreamReader("example.txt");
				 String ^str;
				 while(sr->Read()!= 0)
				 {
					 str=sr->ReadLine();
					 textBox2->Text=sr->ReadLine();
					 MessageBox::Show(str);
				 }
					 sr->Close();

what could be used inside while condition that this will read till the end of the file

no the read to end function does not work with my code i want a way in which my program can read a file till the end

thanks for the reply by the way :)

you mean you want the output tokenized into lines?

yup the read to end function reads all the file and stores it in a single string i got it but i wanted the output tokened in lines

thank u very much was of great help :)

mark as solved :) + glad i could help