added CreateFileOutputStream function

This commit is contained in:
HuYingzhuo(hugo/hyzboy) 2023-07-26 22:26:23 +08:00
parent 9b142b9f6f
commit c39eea296f

View File

@ -88,6 +88,19 @@ namespace hgl
FileOutputStream *operator &(){return fos;} FileOutputStream *operator &(){return fos;}
FileOutputStream *operator ->(){return fos;} FileOutputStream *operator ->(){return fos;}
};//class OpenFileInputStream };//class OpenFileInputStream
inline FileOutputStream *CreateFileOutputStream(const OSString &filename,FileOpenMode fom=FileOpenMode::CreateTrunc)///<创建一个文件输出流
{
auto *fos=new FileOutputStream();
if(!fos->Open(filename,fom))
{
delete fos;
return(nullptr);
}
return fos;
}
}//namespace io }//namespace io
}//namespace hgl }//namespace hgl
#endif//HGL_IO_FILE_OUTPUT_STREAM_INCLUDE #endif//HGL_IO_FILE_OUTPUT_STREAM_INCLUDE