A
Andre Paim
The following program:
#include <iostream>
#include <iterator>
#include <istream>
#include <sstream>
int main()
{
char buffer[] = {0x01, 0x0C, 0x1B};
std::stringbuf str_buf;
str_buf.pubsetbuf(buffer, sizeof (buffer));
std::istream iss(&str_buf);
std::cout.setf( std::ios::hex, std::ios::basefield );
std::copy(std::istream_iterator<char>(iss),
std::istream_iterator<char>(), std:stream_iterator<unsigned
short>(std::cout, " "));
return (0);
Generates the output (gcc 4.2 on Linux):
1 1b
Why it does not print the 0x0C value?
Is there any way to modify this program in order to print the 3 bytes?
Regards,
Andre
#include <iostream>
#include <iterator>
#include <istream>
#include <sstream>
int main()
{
char buffer[] = {0x01, 0x0C, 0x1B};
std::stringbuf str_buf;
str_buf.pubsetbuf(buffer, sizeof (buffer));
std::istream iss(&str_buf);
std::cout.setf( std::ios::hex, std::ios::basefield );
std::copy(std::istream_iterator<char>(iss),
std::istream_iterator<char>(), std:stream_iterator<unsigned
short>(std::cout, " "));
return (0);
Generates the output (gcc 4.2 on Linux):
1 1b
Why it does not print the 0x0C value?
Is there any way to modify this program in order to print the 3 bytes?
Regards,
Andre