Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 988
sxingfeng Avatar asked Jun 18 '10 08:06

sxingfeng


People also ask

How to convert int to CString in mfc?

Solution 3. CString MyString; int MyInt; MyString. Format(L"%d",MyInt); Another way is to use the std library's to_wstring[^], and then cast the result to CString.


1 Answers

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.

like image 180
ryan_s Avatar answered Oct 04 '22 10:10

ryan_s