Created
February 15, 2018 00:23
-
-
Save evaporei/0638482ffd5d375405052c24ac319cd6 to your computer and use it in GitHub Desktop.
Read binary file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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