Skip to content

Instantly share code, notes, and snippets.

@evaporei
Created February 15, 2018 00:23
Show Gist options
  • Save evaporei/0638482ffd5d375405052c24ac319cd6 to your computer and use it in GitHub Desktop.
Save evaporei/0638482ffd5d375405052c24ac319cd6 to your computer and use it in GitHub Desktop.
Read binary file
use std::fs::File;
use std::io::Read;
fn main()
{
let mut file = File::open("file2").unwrap();
for byte in file.bytes() {
match byte {
Ok(v) => println!("{:b}", v),// or {:x} for hex
_ => (),
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment