如何将INT64写入CString

时间:2010-06-18 08:19:51

标签: c++ windows mfc cstring int64

我在c ++窗口中编码。

INT64 dirID = -1;
CString querySQLStr = _T("");
querySQLStr.Format(L"select * from ImageInfo where FolderPath=%64d;", dirID);

querySQLStr always like this:
select * from ImageInfo where FolderPath=                                                            1214;

使用%64d是对的吗? 非常感谢

3 个答案:

答案 0 :(得分:8)

我没有方便测试这个的Windows机器,但我认为CString应该接受这个:

querySQLStr.Format("%I64d", dirID);

值得注意的是,这是特定于Windows的,但由于你使用的是CString,我猜这没关系。

答案 1 :(得分:0)

我想你需要尝试这个:

__int64 val;
......
ParamVal.Format( _T("%d{I64}"), val);

答案 2 :(得分:0)

%lld %I64d 都一样。

strCode.Format(_T("Code = %lld, Result = %I64d \n"),lCode,lResult);