共用方式為


file_stream::open_ostream Method

Open a new ouput stream representing the given file. If the file does not exist, it will be create unless the folder or directory where it is to be found also does not exist.

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
);

Parameters

  • file_name
    The name of the file

  • mode
    The opening mode of the file

  • prot
    The file protection mode

  • file
    The StorageFile reference representing the file

Return Value

A task that returns an opened output stream on completion.

Requirements

Header: filestream.h

Namespace: concurrency::streams

See Also

Reference

file_stream Class