如何将INT64写入CString

sxi*_*eng 4 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;
Run Code Online (Sandbox Code Playgroud)

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

rya*_*n_s 8

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

querySQLStr.Format("%I64d", dirID);
Run Code Online (Sandbox Code Playgroud)

值得注意的是,这是特定于Windows的,但是因为你正在使用CString,我猜这没关系.