简单的CString问题,如何显示ASCII 127以上的字符

jimmey 2002-03-28 08:33:30
FOR example

CString tmp;
tmp.Format("%c",129);
AfxMessageBox(tmp);

跳出的messagebox 显示的是 ?,很明显是错的

请各位赐教
...全文
59 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
delphihero 2002-04-13
  • 打赏
  • 举报
回复
CString tmp;
TCHAR x;
int y=129;
x=y;
tmp+=x;
AfxMessageBox(tmp);
试试看吧,不一定能有东西.因为有些位置就是空的。而汉字相当于两个 char 字符。unicode 中大小都一样。

jimmey 2002-04-03
  • 打赏
  • 举报
回复
push
jimmey 2002-04-02
  • 打赏
  • 举报
回复
还有建议吗
oyf888 2002-03-29
  • 打赏
  • 举报
回复
我考KAO,他们给你指歪了,应该是代码页和符集的问题,你设置对了就好了,否则就会是汉字了,因为汉字用了128以上的,请设置代码页为1252试一下。
jimmey 2002-03-29
  • 打赏
  • 举报
回复
还有什么有建设性的建议吗?
sunshine_shen 2002-03-29
  • 打赏
  • 举报
回复
不可见的字符,是不能显示的
eggaig 2002-03-28
  • 打赏
  • 举报
回复
127以上的作为汉字(一半)来显示的!!
要显示那就自己画啦!!!
skywolfY 2002-03-28
  • 打赏
  • 举报
回复
显示不出来怎么显示?
天地大美 2002-03-28
  • 打赏
  • 举报
回复
union
{
unsigned char c;
int d;
}dc;
dc.d=129;
printf("%c",dc.c);
delphihero 2002-03-28
  • 打赏
  • 举报
回复
改为"%d"试试
字符转的各种转换函数库,用这个库,字符串的各种转换再也不头疼 //-------------字符串转数字-------------- int CString_numberStr_2_int(CString str); int stdString_2_int(std::string str);//std string 字符串转int int std_hexString_2_int(std::string str);//std string 字符串转int double CString_2_double(CString in); double stdString_2_double(std::string str);//std string 字符串转double unsigned int hexString_2_u32(std::string str); //-------------数字转字符串-------------- CString CString_int_2_numberStr(int n); CString CString_int_2_numberStr6(int n); std::string stdString_int_2_numberStr(int a); CString double_2_number_CString(double n); std::string double_2_number_String(double a); CString GetCurrWorkingDir(); //获得当前工作路径,不含最后一个字符“\” CString ascii_2_cstring(int ascii);// 把ascii字符转换成对应的字符,返回cstring类型 //-------------字符串转字符串-------------- std::string CString_2_stdString(CString str); CString stdString_2_CString(std::string str); void CString_2_charP(CString str,char *q); //cstring change to ansi string //-------------判断字符串类型-------------- bool is_a_double_type_string(CString str); //-------------字符串复杂操作-------------- int break_string(std::string instr, std::string subStr, vectorstring>* subs); //以subStr为标记切割instr为多个单词,存储于subs std::string super_CString::getTimeString(bool fgf);//获得表示当前时间的字符串,fgf表示是否需要分隔符 std::string super_CString::getDateTimeString(bool fgf);//获得表示当前时间和日期的字符串,fgf表示是否需要分隔符 std::string getDateString(bool fgf); //获得表示当前日期的字符串,fgf表示是否需要分隔符 std::string string_trim_LR_space(std::string str);//去除字符串前后的空白字符 std::string string_trim_L_space(std::string str);//去除字符串左边的空白字符 std::string string_trim_R_space(std::string str);//去除字符串右边的空白字符 //-------------GUI相关-------------- CString get_CEdit_text(CEdit* edit); //-------------文件、路径相关-------------- CString calc_CurrWorkingDir_filename(CString str);//返回程序运行的当前路径+filename CString calc_work_full_filename(CString filename,CString path);//path为路径,如果path为空返回程序运行的当前路径+filename,否则返回path+filename。 std::string GetCurrWorkingDir_stdString(); std::string calc_CurrWorkingDir_filename(std::string str); std::string calc_work_full_filename(std::string filename,std::string path);

1,649

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 非技术类
社区管理员
  • 非技术类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧