我是新來C++,所以這可能是一個noobish問題;我有以下功能:BSTR和SysAllockStringByteLen()在C + +
#define SAFECOPYLEN(dest, src, maxlen) \
{ \
strncpy_s(dest, maxlen, src, _TRUNCATE); \
dest[maxlen-1] = '\0'; \
}
short _stdcall CreateCustomer(char* AccountNo)
{
char tmpAccountNumber[9];
SAFECOPYLEN(tmpAccountNumber, AccountNo, 9);
BSTR strAccountNumber = SysAllocStringByteLen(tmpAccountNUmber, 9);
//Continue with other stuff here.
}
當我通過這段代碼調試,我通過在賬號「A101683」的例子。當它執行SysAllocStringByteLen()部分時,帳號成爲中文符號的組合...
任何人都可以對此有所瞭解?
什麼是SAFECOPYLEN? – Naveen 2009-09-16 08:11:16
用SAFECOPYLEN定義更新。 – 2009-09-16 08:26:29