如何将字符串转换为char?字符串char - C++
我已经谷歌搜索,我没有找到我的情况的答案。真的,我试图将int转换为字符,但我的编译器不支持to_string函数,所以我决定将int转换为字符串,然后将字符串转换为char。
我正在使用char [] [],所以我可以存储整数和字符。
stringstream ss;
ss << j; // j is the integer
string s(ss.str());
ascii_text[1][i] = (char)s;
编辑:
我与ASCII字符的工作。
这就是我想要做的。 int a = 10; - > string s =“10”; - > char c ='10';
如果我找到一种直接将int转换为char的方法,我会很高兴。
你通过这样认为? – Rapptz 2013-03-25 20:12:54
http://stackoverflow.com/questions/9655202/how-to-convert-integer-to-string-in-c – Dave 2013-03-25 20:13:34
@Rapptz是的。你为什么要问? – 2013-03-25 20:13:45