Udostępnij za pośrednictwem


FileRandomAccessStream.OpenAsync Method

Definition

Overloads

OpenAsync(String, FileAccessMode)

Opens a stream to an existing file given the file's path.

OpenAsync(String, FileAccessMode, StorageOpenOptions, FileOpenDisposition)

Opens a stream to a file given a file path. If the file does not exist, it can be created using FileOpenDisposition.

OpenAsync(String, FileAccessMode)

Opens a stream to an existing file given the file's path.

public:
 static IAsyncOperation<IRandomAccessStream ^> ^ OpenAsync(Platform::String ^ filePath, FileAccessMode accessMode);
/// [Windows.Foundation.Metadata.Overload("OpenAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<IRandomAccessStream> OpenAsync(winrt::hstring const& filePath, FileAccessMode const& accessMode);
[Windows.Foundation.Metadata.Overload("OpenAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<IRandomAccessStream> OpenAsync(string filePath, FileAccessMode accessMode);
function openAsync(filePath, accessMode)
Public Shared Function OpenAsync (filePath As String, accessMode As FileAccessMode) As IAsyncOperation(Of IRandomAccessStream)

Parameters

filePath
String

Platform::String

winrt::hstring

A path to the file to be opened.

accessMode
FileAccessMode

The permissions level to open the stream with.

Returns

A stream to the specified file.

Attributes

Windows requirements

Device family
Windows 10 Fall Creators Update (introduced in 10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v5.0)

Applies to

OpenAsync(String, FileAccessMode, StorageOpenOptions, FileOpenDisposition)

Opens a stream to a file given a file path. If the file does not exist, it can be created using FileOpenDisposition.

public:
 static IAsyncOperation<IRandomAccessStream ^> ^ OpenAsync(Platform::String ^ filePath, FileAccessMode accessMode, StorageOpenOptions sharingOptions, FileOpenDisposition openDisposition);
/// [Windows.Foundation.Metadata.Overload("OpenWithOptionsAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<IRandomAccessStream> OpenAsync(winrt::hstring const& filePath, FileAccessMode const& accessMode, StorageOpenOptions const& sharingOptions, FileOpenDisposition const& openDisposition);
[Windows.Foundation.Metadata.Overload("OpenWithOptionsAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<IRandomAccessStream> OpenAsync(string filePath, FileAccessMode accessMode, StorageOpenOptions sharingOptions, FileOpenDisposition openDisposition);
function openAsync(filePath, accessMode, sharingOptions, openDisposition)
Public Shared Function OpenAsync (filePath As String, accessMode As FileAccessMode, sharingOptions As StorageOpenOptions, openDisposition As FileOpenDisposition) As IAsyncOperation(Of IRandomAccessStream)

Parameters

filePath
String

Platform::String

winrt::hstring

A path to the file to be opened.

accessMode
FileAccessMode

The permissions level to open the stream with.

sharingOptions
StorageOpenOptions

A bitwise combination of the enumeration values that specify options for opening the stream.

openDisposition
FileOpenDisposition

An action to take on the file.

Returns

A stream to the specified file.

Attributes

Windows requirements

Device family
Windows 10 Fall Creators Update (introduced in 10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v5.0)

Applies to