Answers for "read files with rust"

5

read file contents in rust

use std::fs;

fn main() {
    let data = fs::read_to_string("file_name.txt").expect("Unable to read file");
    println!("{}", data);
}
Posted by: Guest on September-13-2021

Browse Popular Code Answers by Language