I have a little spoky problem here. I really cant understand what it is.
I am reading a file that is completely empty. But still the second MessageBox is showing this string:
"22"
I cant wrap my head around why if( line != "" ) is executing and no character is shown inbetween the "22" ?
String^ line = "";
WebClient^ Client = gcnew WebClient();
Client->Credentials = gcnew NetworkCredential("username", "password");
Stream^ strm = Client->OpenRead("file1.txt");
StreamReader^ sr = gcnew StreamReader(strm);
line = sr->ReadLine();
sr->Close();
strm->Close();
if( line == "" )
{
MessageBox::Show("1" + line + "1");
}
if( line != "" )
{
MessageBox::Show("2" + line + "2");
}