-1

I'm getting the next error using this code: (System.IndexOutOfRangeException)

int main(array<System::String ^> ^args)
{

String^ str="C:\\somefile.txt";

StreamReader^ sr=gcnew StreamReader(str);

String^ mystr=sr->ReadToEnd();

int i=0;

while (mystr[i++]!='\0')  //what's wrong wth this check?
{
  Console::Write(mystr[i]);
}
}
4

1 に答える 1