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(())
Many readers of this forum will ignore code snippets, compiler error reports, etc that do not follow the posting guidelines for new contributors that are pinned to the top of this forum. Even those who do respond may feel that the lack of following the forum posting guidelines is disrespectful of their time. Thanks.