« | July 2025 | » | 日 | 一 | 二 | 三 | 四 | 五 | 六 | | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | | | |
| 公告 |
谦卑,荣誉,牺牲,英勇,怜悯,诚实,精神,公正。 |
Blog信息 |
blog名称: 日志总数:183 评论数量:698 留言数量:7 访问次数:3016703 建立时间:2005年12月29日 |

| |
[网上东东]int char* float与CString 之间的转换 读书笔记, 软件技术
newqiang 发表于 2006/1/1 13:16:27 |
1。 int <->CString
1) int ->CString
int n = 1;
CString str;
str.Format("%d",n);
2) CString->int
CString str = "1";
int n = atoi(str.GetBuffer(0));
2. char* 与CString
1)char*->CString
char sz[128];
CString str;
str.Format("%s",sz);
2) CString -> char*
CString str;
int nLength = str.GetLength();
char* sz = new char[nLength];
sz = str.GetBuffer(0);
3. float<->CString
1)float->CString
float f = 0.0;
CString str;
str.Format("%f",f);
2) CString->float
CString str = "0.0";
float f = atof(str.GetBuffer(0)); |
|
回复:int char* float与CString 之间的转换 读书笔记, 软件技术
没有(游客)发表评论于2009/9/20 12:02:24 |
float--->CString
不能将参数 1 从“const char [3]”转换为“const wchar_t *” |
|
回复:int char* float与CString 之间的转换 读书笔记, 软件技术
ninicao(游客)发表评论于2007/9/16 9:21:21 |
|
dfdf 读书笔记, 软件技术
ffffffff(游客)发表评论于2007/8/14 22:29:34 |
|
回复:int char* float与CString 之间的转换 读书笔记, 软件技术
yzxb010(游客)发表评论于2006/10/20 0:40:45 |
'atoi' : cannot convert parameter 1 from 'unsigned short *' to 'const char *'
以下为blog主人的回复:
废话。itoa() |
|
回复:int char* float与CString 之间的转换 读书笔记, 软件技术
hhk(游客)发表评论于2006/3/29 18:00:37 |
2) CString -> char*
CString str;
int nLength = str.GetLength();
char* sz = new char[nLength];
sz = str.GetBuffer(0);
错误!会造成内存泄露;
char* sz = new char[nLength];
sz = str.GetBuffer(0);
应改为:
char* sz = str.GetBuffer(0); |
|
回复:int char* float与CString 之间的转换 读书笔记, 软件技术
newqiang发表评论于2006/1/9 11:35:45 |
你的意思是把int[]全部放到一个cstring里还是放到cstring[]里面。如果是后者,则根据第三点可以解决。如果是前者,是否可以先转成char*,在根据第二点解决,或者定义cstring[],全部转成cstring[],然后进行“+”,应该就可以了。。。
呵呵,我也是初学者,多多指教。 |
|
回复:int char* float与CString 之间的转换 读书笔记, 软件技术
bone(游客)发表评论于2006/1/9 11:14:27 |
|
» 1 »
|