简体   繁体   中英

How to write INT64 to CString

I am coding in c++ windows.

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;

is it right to use %64d? Many Thanks

I don't have a windows machine handy to test this on, but I think CString should accept this:

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

It's probably worth noting that this is windows specific, but since you're using CString I guess that's okay.

i think you need to try this:

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

%lld%I64d也同样有效。

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM