use std::fs::File;
use std::io::{Write, BufReader, BufRead};
use std::io;
fn main() {
run();
}
fn run() -> Result<(), io::Error> {
let path = "hosts.txt";
let mut output = File::create(path)?;
write! (output, "host, Ip
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcast host
::1 localhost")?;
let input = File::open(path)?;
let buffered = BufReader::new(input);
for line in buffered.lines().skip(7 ) { // I need to skip the first line of the file
let record = line?;
println!("{:#?}", record);
let mut dog = String::new();
record::stdin().read_line(&mut dog).unwrap();
println!("Hello {}!", dog);
let data: Vec<&str> = record.split_whitespace().collect();
}
Ok(())
}