How to write INT64 in 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% 64d correct to use? Many thanks

+3
source share
2 answers

I don't have a window machine convenient for checking this out, but I think CString should accept this:

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

It may be worth noting that it depends on Windows, but since you are using CString, I think that everything is in order.

+8
source

I think you need to try:

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

Source: https://habr.com/ru/post/1750632/


All Articles