endianize.cc
Go to the documentation of this file.00001 #include <vector>
00002 #include <iterator>
00003 #include <iostream>
00004 #include <algorithm>
00005
00006 using namespace std;
00007
00008 main(){
00009
00010 ostream_iterator<char> lOut(cout);
00011
00012 cerr << "This takes characters from stdin,"
00013 << endl
00014 << "reshuffles them in order to"
00015 << endl
00016 << "change 'endianicity' and gives them to"
00017 << endl
00018 << "stdout"
00019 << endl;
00020
00021 while(cin){
00022 char gBuffer[4];
00023 cin.read(gBuffer,4);
00024 if(cin){
00025 reverse(gBuffer,gBuffer+4);
00026 copy(gBuffer,
00027 gBuffer+4,
00028 lOut);
00029 }
00030 }
00031 }