Click here to Skip to main content
15,940,550 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am struggling a seemingly easy thing am trying to do, and I am unable to do it. I was wondering if someone can help. :(

I want to pass in the value of a variable into a string. The variable can be of any type, int, string, etc.

Ideally I want something like,


but I want the value of var1 copied into a std::string variable. how can I do this? :(

1 solution

You need one of the string stream types[^].
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900