#include "stdafx.h"
#include "stringFunctions.h"

/************************************************************************/
/* Takes a system::string and converts it to a nice, standard string.   */
/************************************************************************/
string systemToStdString( System::String ^input ) {
	// Convert system string to a wide character array.
	array<wchar_t,1>^oldCharArray = input->ToCharArray();

	// Get the length of the system string.
	int length = input->Length;

	// create a new std::string
	string *outputString = new string();

	// Loop through the character array and append it to the std::string
	for( int i = 0; i < length; i++ ) {
		*outputString += (char)oldCharArray[i];
	}

	// Return the nice string.
	return *outputString;
}