#include #include #include #include #include #include #include int main(int argc, char* argv[]) { int fdout = open(argv[1], O_WRONLY | O_CREAT | O_TRUNC, 0600); if (fdout == -1) { return 1; } unsigned short x; while (scanf("%hu", &x) == 1) { unsigned char buf[2]; buf[0] = x >> 8; buf[1] = x & 0xff; write(fdout, &x, 2); } close(fdout); return 0; }