Hello SA,
Many thanks for your reply. It looks like I was really confused by the pure C++ and C++/CLR programmng. I have checked my code and adjusted based on your answer. I have removed the functions Marshal and WriteDataToFile, I added the namespace
using namespace System::IO;
as your said.with more codes including
System::IO::StreamWriter _writer;
and
_writer.WriteLine("data.txt");
_writer.Flush();
In fact, when i have finished writing for these codes, i felt it is impossible to be complied sucessuflly. the compiler displays
1>.\CorrectSerialport.cpp(43) : error C2228: left of '.WriteLine' must have class/struct/union
1>.\CorrectSerialport.cpp(44) : error C2228: left of '.Flush' must have class/struct/union
I think I am still lost and currently not fully understand the syntax. Could you please help to introduce more about how to used the
System::IO:StreamWriter
and
Dispose
in this case? Many thanks for your help again.:)