Hello Kyo,
such conversion is handled by following RTE functions:
EwStringToUtf8()
EwStringToAnsi()
For example:
var string comname = "\\\\.\\COM"+(string)Application::Device.SelectedPorts; //string to convert
native( comname)
{
char COMPORT[ MAX_PATH ];
EwStringToUtf8( comname, COMPORT, sizeof( COMPORT ));
hComm = CreateFileA( COMPORT, ... );
}
Another approach: From your example I deduce that you are working on Win32 API. In such case you can use the wide-char version of the API and pass the Embedded Wizard Strings directly to it. For example:
var string comname = "\\\\.\\COM"+(string)Application::Device.SelectedPorts; //string to convert
native( comname)
{
/* Use the wide-char version of the function (with W in its name) */
hComm = CreateFileW( comname, ... );
}
Best regards
Paul Banach