Sha256: 5beeb0650e6388b8129c9957d29cbc868725749f4a8103952f70c6e1f395af55
Contents?: true
Size: 726 Bytes
Versions: 26
Compression:
Stored size: 726 Bytes
Contents
#pragma once using namespace System::Runtime::InteropServices; ref class StringHelper { public: static void CopyToUnmanagedString(String^ source, char* destination, const int destinationSize) { auto unmanagedString = Marshal::StringToHGlobalAnsi(source); strncpy_s(destination, destinationSize, (const char*)(void*)unmanagedString, _TRUNCATE); Marshal::FreeHGlobal(unmanagedString); } static char* ToUnmanaged(String^ source) { if( nullptr == source ) return NULL; const int numberOfBytes = source->Length + 1; auto unmanagedString = new char[numberOfBytes]; CopyToUnmanagedString(source, unmanagedString, numberOfBytes); return unmanagedString; } };
Version data entries
26 entries across 26 versions & 1 rubygems