FileSystem.Unlock 方法

定義

控制其他程序對使用該 Open 函式開啟的全部或部分檔案的存取。 這個 My 功能能讓你在檔案 I/O 操作 Lock 中比 and Unlock更好,且效能更高。 如需詳細資訊,請參閱FileSystem

多載

名稱 Description
Unlock(Int32)

控制其他程序對使用該 Open 函式開啟的全部或部分檔案的存取。 這個 My 功能能讓你在檔案 I/O 操作 Lock 中比 and Unlock更好,且效能更高。 如需詳細資訊,請參閱FileSystem

Unlock(Int32, Int64)

控制其他程序對使用該 Open 函式開啟的全部或部分檔案的存取。 這個 My 功能能讓你在檔案 I/O 操作 Lock 中比 and Unlock更好,且效能更高。 如需詳細資訊,請參閱FileSystem

Unlock(Int32, Int64, Int64)

控制其他程序對使用該 Open 函式開啟的全部或部分檔案的存取。 這個 My 功能能讓你在檔案 I/O 操作 Lock 中比 and Unlock更好,且效能更高。 如需詳細資訊,請參閱FileSystem

Unlock(Int32)

來源:
FileSystem.vb
來源:
FileSystem.vb
來源:
FileSystem.vb
來源:
FileSystem.vb
來源:
FileSystem.vb

控制其他程序對使用該 Open 函式開啟的全部或部分檔案的存取。 這個 My 功能能讓你在檔案 I/O 操作 Lock 中比 and Unlock更好,且效能更高。 如需詳細資訊,請參閱FileSystem

public:
 static void Unlock(int FileNumber);
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("macos")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public static void Unlock(int FileNumber);
public static void Unlock(int FileNumber);
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("macos")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
static member Unlock : int -> unit
static member Unlock : int -> unit
Public Sub Unlock (FileNumber As Integer)

參數

FileNumber
Int32

Required. 任何有效的檔案號碼。

屬性

例外狀況

檔案模式無效。

範例

此範例說明了 和 Lock 函數的使用Unlock。 此範例假設 是一個 People.txt 包含結構 Person記錄的檔案。

Structure Person
    Dim Name As String
    Dim ID As Integer
End Structure

Sub PutInLockedFile(ByVal onePerson As Person)
    FileOpen(1, "c:\people.txt", OpenMode.Binary)
    Lock(1)
    FilePut(1, onePerson)
    Unlock(1)
    FileClose(1)
End Sub

備註

LockUnlock函式用於多個程序可能需要存取同一檔案的環境。

LockUnlock 數總是成對使用。 與 的LockUnlock論證必須相同。

Record未提供 ,或 FromRecordToRecord ,則鎖將涵蓋整個檔案。 若 Record 指定單獨,該單一紀錄將被鎖定或解鎖。

若檔案已被開啟進行順序輸入或輸出, LockUnlock 影響整個檔案,不論由 FromRecordToRecord 指定的範圍。

另請參閱

適用於

Unlock(Int32, Int64)

來源:
FileSystem.vb
來源:
FileSystem.vb
來源:
FileSystem.vb
來源:
FileSystem.vb
來源:
FileSystem.vb

控制其他程序對使用該 Open 函式開啟的全部或部分檔案的存取。 這個 My 功能能讓你在檔案 I/O 操作 Lock 中比 and Unlock更好,且效能更高。 如需詳細資訊,請參閱FileSystem

public:
 static void Unlock(int FileNumber, long Record);
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("macos")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public static void Unlock(int FileNumber, long Record);
public static void Unlock(int FileNumber, long Record);
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("macos")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
static member Unlock : int * int64 -> unit
static member Unlock : int * int64 -> unit
Public Sub Unlock (FileNumber As Integer, Record As Long)

參數

FileNumber
Int32

Required. 任何有效的檔案號碼。

Record
Int64

Optional. 唯一需要鎖定或解鎖的記錄或位元組的數量。

屬性

例外狀況

檔案模式無效。

範例

此範例說明了 和 Lock 函數的使用Unlock。 此範例假設 是一個 People.txt 包含結構 Person記錄的檔案。

Structure Person
    Dim Name As String
    Dim ID As Integer
End Structure

Sub PutInLockedFile(ByVal onePerson As Person)
    FileOpen(1, "c:\people.txt", OpenMode.Binary)
    Lock(1)
    FilePut(1, onePerson)
    Unlock(1)
    FileClose(1)
End Sub

備註

LockUnlock函式用於多個程序可能需要存取同一檔案的環境。

LockUnlock 數總是成對使用。 與 的LockUnlock論證必須相同。

Record未提供 ,或 FromRecordToRecord ,則鎖將涵蓋整個檔案。 若 Record 指定單獨,該單一紀錄將被鎖定或解鎖。

若檔案已被開啟進行順序輸入或輸出, LockUnlock 影響整個檔案,不論由 FromRecordToRecord 指定的範圍。

另請參閱

適用於

Unlock(Int32, Int64, Int64)

來源:
FileSystem.vb
來源:
FileSystem.vb
來源:
FileSystem.vb
來源:
FileSystem.vb
來源:
FileSystem.vb

控制其他程序對使用該 Open 函式開啟的全部或部分檔案的存取。 這個 My 功能能讓你在檔案 I/O 操作 Lock 中比 and Unlock更好,且效能更高。 如需詳細資訊,請參閱FileSystem

public:
 static void Unlock(int FileNumber, long FromRecord, long ToRecord);
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("macos")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public static void Unlock(int FileNumber, long FromRecord, long ToRecord);
public static void Unlock(int FileNumber, long FromRecord, long ToRecord);
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("macos")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
static member Unlock : int * int64 * int64 -> unit
static member Unlock : int * int64 * int64 -> unit
Public Sub Unlock (FileNumber As Integer, FromRecord As Long, ToRecord As Long)

參數

FileNumber
Int32

Required. 任何有效的檔案號碼。

FromRecord
Int64

Optional. 第一個記錄或位元組的數量,需要鎖定或解鎖。

ToRecord
Int64

Optional. 最後一個記錄或位元組的數量,需要鎖定或解鎖。

屬性

例外狀況

檔案模式無效。

範例

此範例說明了 和 Lock 函數的使用Unlock。 此範例假設 是一個 People.txt 包含結構 Person記錄的檔案。

Structure Person
    Dim Name As String
    Dim ID As Integer
End Structure

Sub PutInLockedFile(ByVal onePerson As Person)
    FileOpen(1, "c:\people.txt", OpenMode.Binary)
    Lock(1)
    FilePut(1, onePerson)
    Unlock(1)
    FileClose(1)
End Sub

備註

LockUnlock函式用於多個程序可能需要存取同一檔案的環境。

LockUnlock 數總是成對使用。 與 的LockUnlock論證必須相同。

Record未提供 ,或 FromRecordToRecord ,則鎖將涵蓋整個檔案。 若 Record 指定單獨,該單一紀錄將被鎖定或解鎖。

若檔案已被開啟進行順序輸入或輸出, LockUnlock 影響整個檔案,不論由 FromRecordToRecord 指定的範圍。

另請參閱

適用於