-1
我想瀏覽使用C++ Visual Studio 2010中的Windows應用程序窗體的文件。此代碼給出以下錯誤。任何人都可以幫助解決這個問題在瀏覽文件C++中的錯誤
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
Stream^ myStream;
OpenFileDialog^ openFileDialog1 = gcnew OpenFileDialog;
openFileDialog1->InitialDirectory = "c:\\";
openFileDialog1->Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
openFileDialog1->FilterIndex = 2;
openFileDialog1->RestoreDirectory = true;
if (openFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK)
{
if ((myStream = openFileDialog1->OpenFile()) != nullptr)
{
// Insert code to read the stream here.
myStream->Close();
}
}
}
錯誤1錯誤C2065: '流':未聲明的標識符C:\用戶\
錯誤2錯誤C2065:myStream「:未聲明的標識符
錯誤3錯誤C2065:myStream':未聲明的標識符
錯誤4錯誤C2065:myStream':未聲明的標識符
錯誤5錯誤C2227:左Ò f' - >關閉'必須指向
您認爲'^'在C++中意味着什麼? – Beta
我不知道我在這個論壇上發佈了這個代碼 – user2740528
這段代碼不是C++。 – mvp