use std::{env, process};
fn main() {
let a = vec![
String::from("hello"),
String::from("world"),
];
println!("size of vector is :{}",a.len());
println!("{:?}",a);
write_vec_to_file(a, "123.txt");
}
//将vec里的内容写出到文件
fn write_vec_to_file(slice: Vec<String>, filename: &str) -> std::io::Result<()> {
let new_content = slice.join("\r\n");
std::fs::write(filename, new_content)?;
// println!("{:#?}",new_content);
// println!("保存文件:{}",filename);
Ok(())
} // fn end
如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!
txttool.com 说一段 esp56物联 查询128 IP查询