#include <fstream>
std::ofstream file(output_filename, std::ios::binary);
if (!file.is_open())
{
std::cerr << "Failed to open output file." << std::endl;
return;
}
file.close();
// 打开输出文件
FILE *file = fopen(output_filename, "wb");
if (!file)
{
std::cerr << "Failed to open output file." << std::endl;
png_destroy_write_struct(&png_ptr, &info_ptr);
return;
}
fclose(file);