1>PATH TO PROGRAM\Form1.h(199): error C2653: 'Marshal' : is not a class or namespace name
1>PATH TO PROGRAM\Form1.h(199): error C2228: left of '.ToPointer' must have class/struct/union
1> type is ''unknown-type''
1>PATH TO PROGRAM\Form1.h(199): error C3861: 'StringToHGlobalAnsi': identifier not found
1>PATH TO PROGRAM\Form1.h(200): error C2065: 'ofstream' : undeclared identifier
1>PATH TO PROGRAM\Form1.h(200): error C2146: syntax error : missing ';' before identifier 'File'
1>PATH TO PROGRAM\Form1.h(200): error C3861: 'File': identifier not found
1>PATH TO PROGRAM\Form1.h(201): error C2653: 'Marshal' : is not a class or namespace name
1>PATH TO PROGRAM\Form1.h(201): error C3861: 'FreeHGlobal': identifier not found
It's not an additional include you need here, it's another using statement (for another .NET namespace.)
When you working with managed code you've got to (a) add the required assembly reference, if not already added, and (b) add a using statement, i.e. (in this case)
using System::Runtime::InteropServices;
But rather than switching between C++/CLI and C++, you could use the .NET way of reading and writing files?