今天在读取ini文件时,跟踪发现,字符串" 500"用StrToInt转换后得到的结果是零,而不是预期的500,_tstoi就没有这个问题。
郁闷,看来Str系列字符串操作函数与C库函数的并不能等同。之前发现StrChr无法查找'\0',如今又发现StrToInt无法兼容_tstoi。
看来,想抛弃C库函数还是比较困难的。
例子:
郁闷,看来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(','))));
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(','))));
Shlwapi.h 中的实用函数列表
DLL中共享数据陷阱



