|
-
May 18th, 1999, 04:59 PM
#1
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?
-
May 19th, 1999, 05:34 AM
#2
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));
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|