开发者

fileclose in vb.net

开发者 https://www.devze.com 2023-03-12 23:55 出处:网络
i\'m using fileopen() function to open the file, after doing all the works i\'m using fileclose() to close the file. but when i access the fi开发者_如何学Pythonle again it returns already the file is

i'm using fileopen() function to open the file, after doing all the works i'm using fileclose() to close the file. but when i access the fi开发者_如何学Pythonle again it returns already the file is opened by another process.

sample:

Dim intFile As Integer = FreeFile()
FileOpen(intFile, mstrFilename, OpenMode.Binary, OpenAccess.Read, OpenShare.LockWrite)
FileClose(intFile)  

Thanks!


I think you could use the System.IO.File class for all file operations.

Sample:

var fs = File.OpenWrite();
var info = new UTF8Encoding(true).GetBytes("Test of the OpenWrite method.");
fs.Write(info, 0, info.Length);
fs.Close();
0

精彩评论

暂无评论...
验证码 换一张
取 消