StrToInt不能替代_tstoi 不指定 2007/09/12

| |
今天在读取ini文件时,跟踪发现,字符串"  500"用StrToInt转换后得到的结果是零,而不是预期的500,_tstoi就没有这个问题。
郁闷,看来Str系列字符串操作函数与C库函数的并不能等同。之前发现StrChr无法查找'\0',如今又发现StrToInt无法兼容_tstoi。
看来,想抛弃C库函数还是比较困难的。
例子:
Sound=2000, 500
CString str(Sound); // 伪码
/* 失败
Beep(StrToInt(str.Left(str.Find(','))), StrToInt(str.Right(str.Find(','))));
*/
Beep(_tstoi(str.Left(str.Find(','))), _tstoi(str.Right(str.Find(','))));
Tags: , , ,
发表评论

昵称

网址

电邮

打开HTML 打开UBB 表情 打开表情 隐藏 记住我 [注册]