file_stream::open_ostream 方法

打开表示特定文件的新输出流。 如果文件不存在,除非保存该文件的文件夹或目录也不存在,否则将创建该文件。

static pplx::task<streams::basic_ostream<_CharType>> open_ostream(
   const utility::string_t &file_name,
   std::ios_base::openmode mode = std::ios_base::out,
   #ifdef _MS_WINDOWS int prot = (int) std::ios_base::_Openprot #else int prot = 0 #endif
);

static pplx::task<streams::basic_ostream<_CharType>> open_ostream(
   ::Windows::Storage::StorageFile^ file,
   std::ios_base::openmode mode = std::ios_base::out
);

参数

  • file_name
    文件的名称

  • mode
    文件的打开模式

  • prot
    文件保护模式

  • file
    表示该文件的 StorageFile 引用

返回值

task 在完成时返回已打开的输出流。

要求

**标头:**filestream.h

**命名空间:**concurrency::streams

请参见

参考

file_stream 类