Help Newbie _bstr_t - String conversion problem

R

red

How do I:

_bstr_t bID;
std::cout << "Please Enter bID:";
std::cin >> bID;

Obviously getting:

error C2679: binary '>>' : no operator found which takes a right-hand
operand of type '_bstr_t' (or there is no acceptable conversion)


red
 
L

Larry I Smith

red said:
How do I:

_bstr_t bID;
std::cout << "Please Enter bID:";
std::cin >> bID;

Obviously getting:

error C2679: binary '>>' : no operator found which takes a right-hand
operand of type '_bstr_t' (or there is no acceptable conversion)


red

Why not just use the Standard C++ 'string' instead
of the '_bstr_t'? Does it have to be a '_bstr_t'?

Larry
 
P

Panjandrum

Larry said:
Why not just use the Standard C++ 'string' instead
of the '_bstr_t'? Does it have to be a '_bstr_t'?

Yes, if you program in COM and not in C++.
 
S

Swampmonster

Panjandrum said:
Yes, if you program in COM and not in C++.

No, if you're cool and use a std::wstring and
SysAllocString()/SysFreeString() instead.
And _please_ don't use char based strings/streams
when doing COM stuff unless you only use codes 0 to 127.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,816
Latest member
nipsseyhussle

Latest Threads

Top