c - Cannot convert ‘char**’ to ‘wchar_t**’ -
the code excerpt:
int main(int argc, char *argv[]){ pysys_setargv(argc, argv); produces error message
error: cannot convert ‘char**’ ‘wchar_t**’ argument ‘2’ ‘void pysys_setargv(int, wchar_t**)’
how convert argv?
this api part of python 3.0 , above , in knowledge, there's no easy way done. however, think, can try converting argv w_char ** , call pysys_setargv(). mbstowcs() may come handy in case.
for example, pseudo-code (not tested) like
wchar_t **changed_argv; changed_argv = malloc((argc)* sizeof*changed_argv); (int = 0; < argc, i++) { changed_argv[i] = malloc(strlen(argv[i]) + 1); mbstowcs(changed_argv[i], argv[i], strlen(argv[i]) + 1); }
Comments
Post a Comment