0
const char *にCStringを追加する方法は?CStringをconst char *に追加するには?
CString custompath = "c:\folder\";
const char *one = "IECapt.exe --url=";
const char *にCStringを追加する方法は?CStringをconst char *に追加するには?
CString custompath = "c:\folder\";
const char *one = "IECapt.exe --url=";
thisをお試しください。
ここで、あなたが望むものを得る方法に関するいくつかの提案を見つけることができます。例えば。このスニペットを使用することができます:
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);
その後、必要がなくなったら、lpszを削除することができます。あるいは、むしろ、あなたはセクション変更CStringの内容にアイデア(単なるアイデア)から、直接を次のような何かができる:
LPTSTR pBuf = custompath.GetBufferSetLength(custompath.GetLength() + strlen(one) + 1);
_tcscpy_s(pBuf + custompath.GetLength(), strlen(one) + 1, one);
custompath.ReleaseBuffer();
クールな原料を...! – karikari
-1答えの代わりにリンク。 – harper
@harper私は情報を抽出して、次の空き時間帯にリンクが怖い自己完結型情報主張者のために要約します。 – ShinTakezou