How to append a CString to a const char*?
开发者_如何转开发CString custompath = "c:\folder\";
const char *one = "IECapt.exe --url=";
Try reading this.
There, you can find some suggestions on how to obtain what you want. E.g. you can use this snippet:
int sizeOfString = custompath.GetLength(); // as in the example
size_t destsize = sizeOfString + strlen(one) + 1;
LPTSTR lpsz = new TCHAR[ destsize ];
_tcscpy_s(lpsz, destsize, theString);
_tcscpy_s(lpsz + sizeOfString, strlen(one)+1, one);
CString completePath(lpsz);
Then you can delete lpsz, if you don't need it anymore. Or, rather, you could do something like the following, from the idea (just the idea) in the section Modifying CString Contents Directly:
LPTSTR pBuf = custompath.GetBufferSetLength(custompath.GetLength() + strlen(one) + 1);
_tcscpy_s(pBuf + custompath.GetLength(), strlen(one) + 1, one);
custompath.ReleaseBuffer();
精彩评论