-
BSTR
I need to how I can create a string which cat' various data to gether and then pass the variable to a BSTR.
e.g.
BSTR name= Information;
LPSTR test=information;
int i=10
sprintf(test,"the value is %i",i);
BSTR=SysAllocString(test);
This does not work. How can I make it work?
-
Re: BSTR
Here's one way:
#include "afxpriv.h"
LPSTR information = "The value is ";
int i = 10;
CString test(information);
char pIToA[4];
itoa( i, pIToA, 10);
test += pIToA;
USES_CONVERSION;
BSTR Information = A2BSTR( test.GetBuffer(2));