Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Writing a string to the screen

Status
Not open for further replies.

drexeliu

Programmer
Joined
May 29, 2001
Messages
2
Location
US
I am trying to simply write a string which has been declared as std::string. I have a function which returns that data type. However, when I call the function and say cout<<(function name), I get the error that there is no right hand side operator which can be used with <<. It says the right hand side is of type std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >.
I have no clue what all this means and how to fix it. It seems to me that this example follows the stl string operator<< example in the MSDN library, but it still won't work.

Any suggestions would be greatly appreciated.
Thanks,
Chris
 
Try this, it might work:

cout<<(std::string)name

Chris Grandin
grandin1@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top