我使用此代码收到下一个错误:(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]);
}
}