Good evening,
i have a file in .rdfc format. The file contains a vector of bytes in little endian format.
i would to read this file and calculate the crc of it.
I tried to use this way:
use std::fs::File;
use std::io::Read;
let mut vec_areas = Vec::new();
let file_open = File::open("myfile.rdfc");
let mut match_names = match file_open {
Ok(file) => file,
Err(_) => return (),
};
let vec_total = match_names.read_to_end(& mut vec_areas);
match vec_total{
Ok(file) => println!("{}", file),
Err(_)=> return (),
};
if i print my file it returns me a size of this one.
You are printing vec_total, the return value of read_to_end, which contains the length if no error occurs. The one holding the bytes is vec_areas, you can check it with println!("{:?}", vec_areas);.