The code excerpt:
int main(int argc, char *argv[]){
PySys_SetArgv(argc, argv);
produces error message
error: cannot convert ‘char**’ to ‘wchar_t**’ for argument ‘2’ to ‘void PySys_SetArgv(int, wchar_t**)’
How do I convert argv?
You could look into whether your compiler supports wmain. If so, you can replace main with:
int wmain(int argc, wchar_t *argv[])
{
PySys_SetArgv(argc, argv);
Refer to the following link:
how to convert char array to wchar_t array?
You can write a conversion routine:
#include <iostream>
#include <stdlib.h>
#include <string>
using namespace std;
using namespace System;
int main(int argc, char* argv[])
{
char *orig = "Hello, World!";
cout << orig << " (char *)" << endl;
// Convert to a wchar_t*
size_t origsize = strlen(orig) + 1;
const size_t newsize = 100;
size_t convertedChars = 0;
wchar_t wcstring[newsize];
mbstowcs_s(&convertedChars, wcstring, origsize, orig, _TRUNCATE);
wcscat_s(wcstring, L" (wchar_t *)");
wcout << wcstring << endl;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With