C++ routines to do with binaries