0

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

Edited by WaltP: Added CODE Tags -- please use them.

2
Contributors
7
Replies
8
Views
6 Years
Discussion Span
Last Post by MattyRobot
0

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 :)

0

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.