字符替换
char a[]="\'c4\'e3\'c3\'c7\'ba\'c3";怎么将转义字符\'转成\x,变成下面数组bchar b[]="\xc4\xe3\xc3\xc7\xba\xc3";
我试过,单独写'\x'系统编译不过去,怎么处理呢?
#include <stdio.h>
void main()
{
char a[]="\'c4\'e3\'c3\'c7\'ba\'c3";
char b[]="\xc4\xe3\xc3\xc7\xba\xc3";
int i;
for(i=0;a[i];i++)
if(a[i]=='\'')
b[i]='\x';//error C2153: hex constants must have at least one hex digit
else
b[i]=a[i];
printf("ok\n");
printf("%s\n",b);
}