Skip to content

Instantly share code, notes, and snippets.

@Dr-Emann
Created May 30, 2014 19:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dr-Emann/d0bf94c46bbb708b995c to your computer and use it in GitHub Desktop.
Save Dr-Emann/d0bf94c46bbb708b995c to your computer and use it in GitHub Desktop.
#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