fn main() -> std::io::Result<()> {
let filename="D:\\text.txt";
let mut filecontent= String::new();
println!("请输入向文件中写入的内容");
stdin().read_line(&mut filecontent)
.expect("Failed to read line.");
let mut file = OpenOptions::new()
.append(true).open(&filename)?;
file.write(filecontent.as_bytes()).expect("write failed");
Ok(())
}
1
共 1 条评论, 1 页
评论区
写评论学一下md语法。