WX cstrings STR=_T ("? 06600 \ r ");
Int len=WideCharToMultiByte (STR CP_ACP, 0, 1, NULL, 0, NULL, NULL);
Char * buf=new char [len + 1];
WideCharToMultiByte (CP_ACP, 0, STR, 1, buf, len, NULL, NULL);
CodePudding user response:
# include & lt; Windows. H>
#include
#include
Int main () {
The setlocale (LC_ALL, "CHS");
Would be * STR=L "WX" L "\ x00d8" L "06600 \ r";
Int len=WideCharToMultiByte (STR CP_ACP, 0, 1, NULL, 0, NULL, NULL);
Char * buf=new char [len + 1];
WideCharToMultiByte (CP_ACP, 0, STR, 1, buf, len, NULL, NULL);
Printf (" % s \ n ", buf);//WX? 06600
Char * buf1=new char [len + 2];
Int I, j;
For (I=0, j=0; IIf (buf [I]=='? ') {
Buf1 [j]='\ xa6';
Buf1 [j + 1)='\ xd5';
J +=2;
} else {
Buf1 [j]=buf [I];
J++;
}
}
Buf1 [j]=0;
Printf (" % s \ n ", buf1);//WX phi 06600
The delete buf1;
The delete buf.
return 0;
}
CodePudding user response:
# include & lt; Windows. H>
#include
#include
Int main () {
The setlocale (LC_ALL, "CHS");
Would be * STR=L "WX" L "\ x00d8" L "06600 \ r";
Int len=WideCharToMultiByte (STR CP_ACP, 0, 1, NULL, 0, NULL, NULL);
Char * buf=new char [len + 1];
WideCharToMultiByte (CP_ACP, 0, STR, 1, buf, len, NULL, NULL);
Printf (" % s \ n ", buf);//WX? 06600
Char * buf1=new char [len + 2];
Int I, j;
For (I=0, j=0; IIf (buf [I]=='? ') {
Buf1 [j]='\ xa6';
Buf1 [j + 1)='\ xb5';
J +=2;
} else {
Buf1 [j]=buf [I];
J++;
}
}
Buf1 [j]=0;
Printf (" % s \ n ", buf1);//WX Φ 06600
The delete buf1;
The delete buf.
return 0;
}