在给你补充点 CString --> char* 使用 GetBuffer(0)即可,别忘了调用ReleaseBuffer()CString aaa;int i = atoi(aaa.GetBuffer(0));aaa.ReleaseBuffer();
BOOL StrToInt64Ex( LPCTSTR pszString, DWORD dwFlags, LONGLONG * pllRet ); BOOL StrToIntEx( LPCTSTR pszString, DWORD dwFlags, int FAR * piRet ); int StrToInt( LPCTSTR lpSrc ); Windows NT/2000: Requires Windows 2000 (or Windows NT 4.0 with Internet Explorer 4.0 or later). Windows 95/98: Requires Windows 98 (or Windows 95 with Internet Explorer 4.0 or later). Header: Declared in shlwapi.h. Import Library: shlwapi.lib.
int atoi( const char *string );
_int64 _atoi64( const char *string );
long atol( const char *string );
楼上的说的对.
在非UNICODED定义下,用上面的.
在UNICODE定义下,用_wtoi()等,可以参看msdn.
LPCTSTR pszString,
DWORD dwFlags,
LONGLONG * pllRet
);
BOOL StrToIntEx(
LPCTSTR pszString,
DWORD dwFlags,
int FAR * piRet
);
int StrToInt(
LPCTSTR lpSrc
); Windows NT/2000: Requires Windows 2000 (or Windows NT 4.0 with Internet Explorer 4.0 or later).
Windows 95/98: Requires Windows 98 (or Windows 95 with Internet Explorer 4.0 or later).
Header: Declared in shlwapi.h.
Import Library: shlwapi.lib.