如上如所示,我想将一个LPCTSTR型字符串格式化输出,但sprintf貌似不能实现这个功能,我想转换的结果也是LPCTSTR类型以作为loadBitmap()的参数,请问我该怎么办?谢谢!
使用Fromat函数,比如:
CString path;
path.Fromat(_T("FlashDisk:\picSrc\%s.bmp"), name);
sprintf第一个参数要求char 的
而且LPCTSTR 就是 const char, 是常量字符串(不能修改的)
要不就先放到一个char数组里,然后让path指向它
char temp_str[64];
char *name = "haha";
sprintf(temp_str, "FlashDisk:\\picSrc\\%s.bmp", name);
LPCSTR path = temp_str;
sprintf有对应的宽字符版本的wsprintf我记得好像是