How to convert char to string

Hello,
I have a problem where I need to convert a char to a string and then a string to an int. Any help will be greatly thankful!!!

Thanks in Advance
Have you tried anything yourself? You should start there... when a problem with what you've done comes up post your code and we'll help you through the issues
I dont know if this is what you need

typecasting

http://www.cprogramming.com/tutorial/lesson11.html
Char to string:
1
2
3
4
5
6
7
#include <sstream>
#include <string>
stringstream ss;
string s;
char c = 'a';
ss << c;
ss >> s;


String to int:
1
2
3
4
5
6
7
#include <sstream>
#include <string>
stringstream ss;
string s;
int n = 1;
ss << n;
ss >> s;
Last edited on
Repentinus, Thanks for that reply. It tells a noob like me everything I need to know to use it. Thank you. Now I have a piece of code I can try out, experiment with, and learn from.
I would've thought:
string mystring = string(char);
was sufficient.
Topic archived. No new replies allowed.