I have made a little change in your program to make it run by using visual studio 2010... Find the code snippet below:
#include "stdafx.h"
#include <string>
#include <iostream>
#include <fstream>
#include <istream>
#include <msclr\marshal.h>
using namespace System;
using namespace Runtime::InteropServices;
void save_arrays();
int main(array<System::String ^> ^args)
{
save_arrays();
return 0;
}
void save_arrays ()
{
array<String^>^ my_array = gcnew array<String^> {"xxx", "yyy", "zzz"};
for (int i = 0; i< 3; i++)
{
System::String^ clrString = my_array[i];
const char* chars = (const char*)(Marshal::StringToHGlobalAnsi(clrString)).ToPointer();
std::string stdString = chars;
std::cout << stdString << std::endl;
}
return;
}