Skip to content

Instantly share code, notes, and snippets.

@hugopeixoto
Created July 10, 2015 01:08
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 hugopeixoto/c4170178de54a2b25e11 to your computer and use it in GitHub Desktop.
Save hugopeixoto/c4170178de54a2b25e11 to your computer and use it in GitHub Desktop.
extern crate rustc_serialize;
extern crate byteorder;
use std::io;
use std::io::Read;
use rustc_serialize::hex::ToHex;
use byteorder::{BigEndian, ReadBytesExt};
struct IndexHeader {
version : u32,
entry_count : u32
}
fn main() {
let mut reader = io::stdin();
let mut buffer = [0u8; 4];
let mut header = IndexHeader { version: 0, entry_count: 0 };
reader.read(&mut buffer);
header.version = reader.read_u32::<BigEndian>().unwrap();
header.entry_count = reader.read_u32::<BigEndian>().unwrap();
println!("{}", header.version);
println!("{}", header.entry_count);
for i in 0 .. header.entry_count {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment