2.Output an Image
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
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保存失败")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user