KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a single char value, and I need to cast/convert it to a std::string . How can I do this? I know how to go the opposite way, to retrieve a char from a std::string object: you just need to index the string at the appropriate location. For example: str[0] will retrieve the first character in the string. But how do I go the other way? I want something like: char c = 34; std::string s(c); …but this doesn't work (the string is always empty).
Tags (comma-separated)
Save Edits
Cancel