rust 复制文本文件

180it 2023-03-10 PM 914℃ 0条
use std::env;
use std::fs::File;
use std::io;

fn main() -> io::Result<()> {
    let args: Vec<_> = env::args().collect();

    let src = &args[1];
    let dest = &args[2];

    let mut file = File::open(src)?;
    let mut new_file = File::create(dest)?;

    io::copy(&mut file, &mut new_file)?;

    Ok(())
}
支付宝打赏支付宝打赏 微信打赏微信打赏

如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!

标签: none

rust 复制文本文件