ReparsePointAware.OpenFile(String, FileMode, FileAccess, FileShare) 方法

定義

在指定的路徑上開啟 System.IO.FileStream,並具有具有讀取、寫入或讀取/寫入存取權和指定共用選項的指定模式。 如果檔案的正式路徑包含 Windows Reparse Points,則會擲回 UnauthorizedAccessException。 OpenFile 會在執行任何檔案作業之前先釘選目錄。 如果釘選目錄失敗,或目錄是 ReparsePoint,則會擲回 UnauthorizedAccessException。

public static System.IO.FileStream OpenFile (string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share = System.IO.FileShare.None);
static member OpenFile : string * System.IO.FileMode * System.IO.FileAccess * System.IO.FileShare -> System.IO.FileStream
Public Shared Function OpenFile (path As String, mode As FileMode, access As FileAccess, Optional share As FileShare = System.IO.FileShare.None) As FileStream

參數

path
String

目標檔案的完整路徑。

mode
FileMode

作業的 FileMode。 支援 Create、CreateNew、Open 或 OpenOrCreate。

access
FileAccess

要求的 FileAccess 許可權。 如需支援哪些旗標,請參閱 NativeFlagsEx。

share
FileShare

要求的 FileShare 存取權。 如需支援哪些旗標,請參閱 NativeFlagsEx。

傳回

正在開啟之檔案的檔案數據流。 呼叫端負責在作業完成時處置檔案數據流。

例外狀況

路徑包含 Windows Reparse Points,否則無法存取。

適用於