12 lines
370 B
Rust
12 lines
370 B
Rust
use std::{fs::File, io::{BufWriter, Write}};
|
|
|
|
pub fn write_image(content: String, file_path: String) {
|
|
if let Ok(file) = File::create(file_path) {
|
|
let mut writer = BufWriter::new(file);
|
|
if let Err(e) = writer.write(content.as_bytes()) {
|
|
println!("写出失败:{:#}", e)
|
|
}
|
|
} else {
|
|
println!("PPM保存失败")
|
|
}
|
|
} |