Read a file to Vec

    0

    0

    Giovanny Gongora

    Codiga's Rust Recipes

    Read a local fila, store to a Vec<u8> and print the content

    use std::fs;
    
    let data = fs::read("/home/filename").expect("Impossible to read file");
    println!("{}", data.len());
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    Legal
    • Security
    • Privacy Policy
    • Code Privacy
    • Terms of Service
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.