c方法
FILE *fyuvp;
fyuvp = fopen(("/sdcard/hipixel/hi_results/" + outputName_yuv).c_str(), "wb" );
fwrite(outputYuvInfo.pY, 1, OutHeight * OutWidth * 3 / 2, fyuvp);
fclose(fyuvp);
fyuvp = NULL;
c++方法
std::string fileName = folderNames[folderId] + "_v0.3.9.yuv";;
std::ofstream os("/sdcard/hipixel/hi_results/" + fileName, std::ofstream::binary);
if (!os)
{
std::cerr << "Failed to open output file for writing: " << fileName << "\n";
std::exit(EXIT_FAILURE);
}
if (!os.write(( char*)outputYuvInfo.pY, OutWidth*OutHeight*3/2))
{
std::cerr << "Failed to write data to: " << fileName << "\n";
std::exit(EXIT_FAILURE);
}