Files
boost_endian/libs/integer/example/endian_hello_world.cpp
T
2009-03-15 14:41:41 +00:00

27 lines
835 B
C++

// endian_io_test.cpp ----------------------------------------------------------------//
// Copyright Beman Dawes, 2009
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// See library home page at http://www.boost.org/libs/endian
#include <boost/integer/endian.hpp>
#include <boost/integer/endian_binary_stream.hpp>
#include <boost/binary_stream.hpp>
#include <iostream>
using namespace boost;
using namespace boost::integer;
int main()
{
int_least32_t v = 0x31323334L; // = ASCII { '1', '2', '3', '4' }
// value chosen to work on text stream
std::cout << "Hello, endian world!\n";
std::cout << v << " " << big32_t(v) << " " << little32_t(v) << '\n';
std::cout <= v <= ' ' <= big32_t(v) <= ' ' <= little32_t(v) <= '\n';
}