vital_parsley2000 wrote:In the above code the if(SUCCEEDED(hr)) block is not executed.
vital_parsley2000 wrote:What could be the reason ?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
khaliloenit wrote:So can someone help me by a simple example of code
khaliloenit wrote:is this solution will work with SqlServer and Oracle database ?
CPallini wrote:Why are you freeing dest?
BSTR st3 = ::SysAllocStringByteLen(NULL,destLen+srcLen);
(destLen + srcLen + 1)
(destLen + srcLen + 2)
HRESULT StringAppend( BSTR * pdst, const BSTR src);
Mogaambo wrote:1. BSTR * pdst
why pointer here.
BSTR is itself a pointer.
2. What code you have write for StringAppend function ?
HRESULT StringAppend(BSTR * pdest, const BSTR src)
if (pdest == NULL) return E_FAIL;
BSTR tmp = ::SysAllocStringLen(NULL,destLen+srcLen);
if( tmp == NULL) return E_FAIL;
pdest = &tmp;
*pdest = tmp;
Mogaambo wrote:dude you haven't added +2 bytes
Mogaambo wrote:it is crashing as that of mine, but when i added +2 it is running fine
Mogaambo wrote:so whenever i want allocate BSTR do i have 2 add + bytes
BSTR dest = SysAllocString(L"Hi ");
s1 = SysAllocString(L"People, ");
s2 = SysAllocString(L"How do ");
s3 = SysAllocString(L"you ");
s4 = SysAllocString(L"do?");
hr = StringAppend(&dest, s1);
hr = StringAppend(&dest, s2);
hr = StringAppend(&dest, s3);
hr = StringAppend(&dest, s4);
General News Suggestion Question Bug Answer Joke Praise Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.