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

Recommended Answers

All 7 Replies

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.