How to write INT64 to CString

眉间皱痕 提交于 2019-12-10 15:33:51

问题


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


回答1:


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.




回答2:


i think you need to try this:

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


来源:https://stackoverflow.com/questions/3068088/how-to-write-int64-to-cstring

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!