files in windows forms c++

i am making a windows forms project in c++ and i want it to be able to open a .txt file when you click a button. I am using a open dialog box too. I beleive the problem is in the second line of the code below (This is part of the code under the forms1.h {the first line is really line 247}):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
private: System::Void openToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e){
			 Stream^ myStream;
			 OpenFileDialog^ openFileDialog1 = gcnew OpenFileDialog;
			 openFileDialog1->Filter = "All Files |*.*";
			 openFileDialog1->ShowDialog();
			 if ( openFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK){
				 if ( (myStream = openFileDialog1->OpenFile()) != nullptr )
				 {
					 // Insert code to read the stream here.
					 myStream->Close();
				 }
			 }

		 }


The Errors that come up are:

1
2
3
4
5
6
7
8
9
10
11
1
1>Compiling...
1>My Notepad.cpp
1>c:\users\scott\documents\visual studio 2008\projects\my notepad\my notepad\Form1.h(248) : error C2065: 'Fstream' : undeclared identifier
1>c:\users\scott\documents\visual studio 2008\projects\my notepad\my notepad\Form1.h(248) : error C2065: 'myStream' : undeclared identifier
1>c:\users\scott\documents\visual studio 2008\projects\my notepad\my notepad\Form1.h(257) : error C2065: 'myStream' : undeclared identifier
1>c:\users\scott\documents\visual studio 2008\projects\my notepad\my notepad\Form1.h(260) : error C2065: 'myStream' : undeclared identifier
1>c:\users\scott\documents\visual studio 2008\projects\my notepad\my notepad\Form1.h(260) : error C2227: left of '->Close' must point to class/struct/union/generic type
1>        type is ''unknown-type''
1>Build log was saved at "file://c:\Users\Scott\Documents\Visual Studio 2008\Projects\My Notepad\My Notepad\Debug\BuildLog.htm"
1>My Notepad - 5 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
closed account (z05DSL3A)
Classes Used for Reading from and Writing to Streams.

BinaryReader and BinaryWriter read and write encoded strings and primitive data types from and to Streams.

StreamReader reads characters from Streams, using Encoding to convert characters to and from bytes. StreamReader has a constructor that attempts to ascertain what the correct Encoding for a given Stream is, based on the presence of an Encoding-specific preamble, such as a byte order mark.

StreamWriter writes characters to Streams, using Encoding to convert characters to bytes.

StringReader reads characters from Strings. StringReader allows you to treat Strings with the same API, so your output can be either a Stream in any encoding or a String.

StringWriter writes characters to Strings. StringWriter allows you to treat Strings with the same API, so your output can be either a Stream in any encoding or a String.

TextReader is the abstract base class for StreamReader and StringReader. While the implementations of the abstract Stream class are designed for byte input and output, the implementations of TextReader are designed for Unicode character output.

TextWriter is the abstract base class for StreamWriter and StringWriter. While the implementations of the abstract Stream class are designed for byte input and output, the implementations of TextWriter are designed for Unicode character input.
Topic archived. No new replies allowed.