Skip to content

Instantly share code, notes, and snippets.

@Dr-Emann
Created May 30, 2014
Embed
What would you like to do?
#include <stdio.h>
int main() {
FILE *fp;
int i;
fp = fopen("\\\\.\\PhysicalDrive0", "r");
for(i = 0; i < 10; i++) {
printf("%x", (int)fgetc(fp));
}
return 0;
}
use std::io::File;
fn main() {
let mut r = File::open(&Path::new("\\\\.\\PhysicalDrive0");
// r is now Ok(File{...})
let b = r.read_u8();
println!("{}", b);
// Prints Err(unknown error (OS Error 87 (FormatMessageW() returned error 15100)))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment