From c39eea296f1a2d1b4beaa69e14fa988968f8755f Mon Sep 17 00:00:00 2001 From: "HuYingzhuo(hugo/hyzboy)" Date: Wed, 26 Jul 2023 22:26:23 +0800 Subject: [PATCH] added CreateFileOutputStream function --- inc/hgl/io/FileOutputStream.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/inc/hgl/io/FileOutputStream.h b/inc/hgl/io/FileOutputStream.h index 3d823c9..5e5a2cb 100644 --- a/inc/hgl/io/FileOutputStream.h +++ b/inc/hgl/io/FileOutputStream.h @@ -88,6 +88,19 @@ namespace hgl FileOutputStream *operator &(){return fos;} FileOutputStream *operator ->(){return fos;} };//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 hgl #endif//HGL_IO_FILE_OUTPUT_STREAM_INCLUDE