vous etre cool
et comment convertir un string en const wchar_t*
comment convertir un string en wchar_t * ?
#include <string.h>
#include <wchar.h>
void wtoc(wchar_t *toConvert, char *str) {
int count = 0;
int len = wcslen(toConvert);
for(; count < len; count++) {
str[count] = (char) toConvert[count];
}
}
void ctow(const char *toConvert, wchar_t *wstr) {
int count = 0;
int len = strlen(toConvert);
for(; count < len; count++) {
wstr[count] = (wchar_t) toConvert[count];
}
}
void convert(wchar_t wstr[20]) {
char copy[20];
wtoc(wstr, copy);
printf("covertion %s\n";, copy); //élimier cela si vous voulez que ce soit plus clair
}
int main() {
string phrase = "exemple a convertir";
const char *Fichier = new char[phrase.size()+1];
Fichier = phrase.c_str(); //
wchar_t wstr[20];
ctow(Fichier, wstr);
convert(wstr);
cout<< wstr <<"contient la phrase.Elle à été convertit en const wchart * !" << endl;
return 1;
}