将INT和INT转换回ASCII字符 [英] Converting from and INT back to ASCII character
问题描述
大家好,我已经能够将ASCII字符转换为INT,但是如果将它们更改回来,则会损失
。无法在网上找到任何东西(虽然我可能会在错误的地方寻找
!)。有人可以帮帮我吗?
谢谢
Dave
Hi all, i have been able to convert an ASCII character to an INT however im
lost as to how to change them back. Cant find anything on the net (though im
probably looking in the wrong places!). Could anyone help me out?
Thanks
Dave
推荐答案
你好,
你可能意味着别的东西然后以下我想
char Char = static_cast< char>(5);
你的问题是什么?
问候,Ron AF Greve
David Williams < DS ******** @ dsl.pipex.com>在消息中写道
新闻:3f ********************** @ news.dial.pipex.com。 ..
Hi,
You probably mean something else then the following I guess
char Char = static_cast<char>( 5 );
What is exactly your question?
Regards, Ron AF Greve
"David Williams" <ds********@dsl.pipex.com> wrote in message
news:3f**********************@news.dial.pipex.com. ..
大家好,我已经能够将ASCII字符转换为INT,但是如果将它们更改回来,则会丢失
。无法在网上找到任何东西(尽管
我可能在错误的地方寻找!)。任何人都可以帮帮我吗?
谢谢
>
Hi all, i have been able to convert an ASCII character to an INT however im lost as to how to change them back. Cant find anything on the net (though im probably looking in the wrong places!). Could anyone help me out?
Thanks
Dave
>大家好,我已经能够将ASCII字符转换为INT但是
im
> Hi all, i have been able to convert an ASCII character to an INT however
im
输掉了如何更改它们。无法在网上找到任何东西(尽管
我可能在错误的地方寻找!)。有人可以帮我吗?
lost as to how to change them back. Cant find anything on the net (though im probably looking in the wrong places!). Could anyone help me out?
#include< iostream>
#include< sstream>
int main()
{
std :: string s =" 123";
int i = 0;
std :: istringstream iss(s);
iss>>我;
std :: cout<<一世; // 123
i = 321;
std :: ostringstream oss;
oss<<我;
std :: cout<< oss.str(); //" 123"
}
Jonathan
#include<iostream>
#include<sstream>
int main()
{
std::string s = "123";
int i = 0;
std::istringstream iss(s);
iss >> i;
std::cout << i; // 123
i = 321;
std::ostringstream oss;
oss << i;
std::cout << oss.str(); // "123"
}
Jonathan
谢谢你们,这就是诀窍! br />
Dave
" David Williams" < DS ******** @ dsl.pipex.com>在消息中写道
新闻:3f ********************** @ news.dial.pipex.com。 ..
Thanks both of you, that did the trick!
Dave
"David Williams" <ds********@dsl.pipex.com> wrote in message
news:3f**********************@news.dial.pipex.com. ..
大家好,我已经能够将ASCII字符转换为INT,但是如果将它们更改回来,则会丢失
。无法在网上找到任何东西(尽管
我可能在错误的地方寻找!)。任何人都可以帮帮我吗?
谢谢
戴夫
Hi all, i have been able to convert an ASCII character to an INT however im lost as to how to change them back. Cant find anything on the net (though im probably looking in the wrong places!). Could anyone help me out?
Thanks
Dave
这篇关于将INT和INT转换回ASCII字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!