2013-10-15 4 views
-1

C++ Visual Studio 2010에서 Windows 응용 프로그램 양식을 사용하여 파일을 탐색하려고합니다.이 코드는 다음과 같은 오류를 제공합니다. '스트림': 선언되지 않은 식별자 C : \ 사용자파일 찾아보기 오류 C++

오류이 오류 C2065 \ 'myStream': 선언되지 않은 식별자

오류 3 사람이 문제

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 해결을 도와 드릴까요 오류 C2065 'myStream'선언되지 않은 식별자

오류 4 오류 C2065 'myStream'선언되지 않은 식별자

오류 5는 오류 C2227 : O 왼쪽 f '-> 닫기'가 가리켜 야합니다

+3

'^'은 C++에서 무엇을 의미한다고 생각하십니까? – Beta

+0

이 포럼의 게시물에서이 코드를 가져 왔다는 것을 알지 못합니다. – user2740528

+0

이 코드는 C++가 아닙니다. – mvp

답변

0

코드 파일 맨 위에 추가하면 오류가 제거됩니다.

네임 스페이스 시스템 :: IO