how to write binary datas in a file