强制转换没用,vc会告诉你“无法将unsigned char*转换为const char*”
解决方案 »
- 刷新窗口的方法
- 请教-installshield中DIFxDriverPackageInstall函数的使用问题
- ACTIVEX控件属性分类
- 请问下在 debug 模式下可以跑, release 下却会产生 linling error........
- 属性表提问
- 菜鸟问题,请问 VC 中有没有像 Delphi 中的 packed record 数据类型
- 去看看吧,很有趣!
- 请TigerHu(愁煞人)和dansu()两人进来拿分(3)
- 用VC编译,连接 的时候出现的错误
- 如何得到CGridCtrl表格中某个单元格元素的内容?
- 我的vc为什么不支持BOOL(大写)?
- 各业大侠,教教小弟如何在指定设备场景用异或模式输出字符,十万火急!
len为字符串的长度
chartobyte(char *a,BYTE *b,int len)
{
for(int i=0;i<len;i++)
b[i]=(BYTE)a[i];
}
害的我还特地试了一下,结果是可以。把Warning Level调到4都没问题。
分两步转:
unsigned char* s;
const char* p = (const char*)(char*)s;
unsigned char* comment;
char *temp;
WideCharToMultiByte(CP_ACP, 0, comment, -1, temp, 256, NULL, NULL);//第六个参数不是很确定
编译后:
error C2664: 'WideCharToMultiByte' : cannot convert parameter 3 from 'unsigned char *' to 'const unsigned short *'
望赐教
char temp[256];
WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)comment, -1, temp, 256, NULL, NULL);