Click here to Skip to main content
15,886,199 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Append BStr Pin
CPallini13-May-09 2:43
mveCPallini13-May-09 2:43 
AnswerRe: Append BStr Pin
«_Superman_»12-May-09 21:52
professional«_Superman_»12-May-09 21:52 
AnswerRe: Append BStr Pin
KarstenK12-May-09 22:25
mveKarstenK12-May-09 22:25 
GeneralRe: Append BStr Pin
Mogaambo12-May-09 22:28
Mogaambo12-May-09 22:28 
GeneralRe: Append BStr Pin
Rajesh R Subramanian12-May-09 22:37
professionalRajesh R Subramanian12-May-09 22:37 
GeneralRe: Append BStr Pin
KarstenK12-May-09 22:41
mveKarstenK12-May-09 22:41 
GeneralRe: Append BStr Pin
Mogaambo12-May-09 22:51
Mogaambo12-May-09 22:51 
AnswerRe: Append BStr [modified] Pin
Madhu Nair12-May-09 22:55
Madhu Nair12-May-09 22:55 
Mogaambo wrote:

BSTR strComma=::SysAllocString(L",");
BSTR strNewLine=::SysAllocString(L"\n");


What about changing BSTR to _bstr_t ?
Defined in comutil.h

The MSDN link says that,

A _bstr_t object encapsulates the BSTR data type. The class manages resource allocation and deallocation through function calls to SysAllocString and SysFreeString and other BSTR APIs when appropriate. The _bstr_t class uses reference counting to avoid excessive overhead.

--++++++---

Use the += operator of _bstr_t to append characters to the end.

if value is also declared as a type of _bstr_t then code can be re-written as,

value += strComma;
value += strNewLine;

Thumbs Up | :thumbsup:

modified on Wednesday, May 13, 2009 5:12 AM

GeneralRe: Append BStr Pin
Mogaambo12-May-09 23:51
Mogaambo12-May-09 23:51 
GeneralRe: Append BStr Pin
KarstenK12-May-09 23:47
mveKarstenK12-May-09 23:47 
GeneralRe: Append BStr Pin
Mogaambo13-May-09 1:20
Mogaambo13-May-09 1:20 
GeneralRe: Append BStr Pin
KarstenK13-May-09 1:59
mveKarstenK13-May-09 1:59 
Questionhi plz help me Pin
priyakp12-May-09 21:01
priyakp12-May-09 21:01 
AnswerRe: hi plz help me Pin
Madhu Nair12-May-09 21:05
Madhu Nair12-May-09 21:05 
AnswerRe: hi plz help me Pin
CPallini12-May-09 21:06
mveCPallini12-May-09 21:06 
JokeRe: hi plz help me Pin
Naveen12-May-09 22:14
Naveen12-May-09 22:14 
QuestionGet groups and the number of associated users in that group in a system ? Pin
Mogaambo12-May-09 19:54
Mogaambo12-May-09 19:54 
AnswerRe: Get groups and the number of associated users in that group in a system ? Pin
«_Superman_»12-May-09 20:07
professional«_Superman_»12-May-09 20:07 
AnswerRe: Get groups and the number of associated users in that group in a system ? Pin
Madhu Nair12-May-09 20:50
Madhu Nair12-May-09 20:50 
QuestionProblem in using toolbar. Pin
Le@rner12-May-09 19:47
Le@rner12-May-09 19:47 
Question[Message Deleted] Pin
lek25812-May-09 19:22
lek25812-May-09 19:22 
JokeRe: Creating ISO9660 Image File(URGENT PLEASE) Pin
Michael Schubert13-May-09 0:15
Michael Schubert13-May-09 0:15 
GeneralRe: Creating ISO9660 Image File(URGENT PLEASE) [modified] Pin
enhzflep13-May-09 5:15
enhzflep13-May-09 5:15 
QuestionTo read a complete string Pin
Pankaj D.Dubey12-May-09 18:52
Pankaj D.Dubey12-May-09 18:52 
AnswerRe: To read a complete string Pin
Chandrasekharan P12-May-09 19:10
Chandrasekharan P12-May-09 19:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.