Test write binary code to file