Mike Cat (Mikecat)
From: Old cat の Ide
The FileStream object provides channels for the read and write operations of the file, and the File object is equivalent to providing a file handle, in the file operation, the FileStream object is relatively simple. Creating a FileStream object Creating a FileStream object You can use the Create method of the File object or an OPEN method, or the constructor of the FileStream object can also be used.
Create method using the File object
Dim MikecatStream as FileStream
MikecatStream = file.create ("c: /mikecat.txt")
Open method using the File object
Dim MikecatStream as FileStream
MikecatStream = file.open ("c: /mikecat.txt ,filemode.openorcreate ,fileaccess.write")
Use the constructor of the FILESTREAM object
DIM MikecatStream As New FileStream ("C: /Mikecat.txt", FileMode.Open, FileAccess.write
The main method of the FILESTREAM object
In the file read and write operation, the most important two methods of the FileStream object are the Lock and UNLOCK methods. Since the FILESTREAM object provides channel read and write, a file may have multiple file channels to operate on the file, sometimes in order to avoid the confusion of data writing and reading, you need a single channel operation, you can use the Lock method to lock the file. To prevent other processes from operating files. After the operation is completed, you can use the UNLOCK method to unlock the already locked file and operate from the newly allowed other processes.