A
Alan Ning
Hi all,
Say I have the following,
string str("Hello World\n")
I would like to extract 5 bits at a time from the string. I am doing
this to convert ascii string to another string type.
Is there a way to do this with stringstream and bitset?
I've been trying something like the following:
std::bitset<5> bsBit;
std::string strTemp = "hello, world\n";
std::stringstream ss;
ss << strTemp <<std::endl;
ss >> bsBit;
std::cout<<bsBit.to_ulong() <<std::endl;
It doesn't seem to work.
I am fairly new to stringstream, any comment is welcome.
Thanks
.... Alan
Say I have the following,
string str("Hello World\n")
I would like to extract 5 bits at a time from the string. I am doing
this to convert ascii string to another string type.
Is there a way to do this with stringstream and bitset?
I've been trying something like the following:
std::bitset<5> bsBit;
std::string strTemp = "hello, world\n";
std::stringstream ss;
ss << strTemp <<std::endl;
ss >> bsBit;
std::cout<<bsBit.to_ulong() <<std::endl;
It doesn't seem to work.
I am fairly new to stringstream, any comment is welcome.
Thanks
.... Alan