在指定路径下建文件,书写文件内容(VB.NET)
Module Module1
Sub Main()
WriteText("TextTest")
End Sub
Private Sub WriteText(ByVal Msg As String)
Dim FileName As String, FileNum As Integer
Dim strOut As String
Dim LogFolder As String
LogFolder = "C:/Folder"
If (System.IO.Directory.Exists(LogFolder) = False) Then LogFolder = "C:"
FileName = LogFolder + "/" + "ABC.txt"
FileNum = FreeFile()
FileSystem.FileOpen(FileNum, FileName, OpenMode.Append)
strOut = Format(Now, "yyyy/MM/dd HH:mm:ss") & "." & Right(Format(Timer, "#0.00"), 2) & "," & Msg
PrintLine(FileNum, strOut)
FileClose(FileNum)
End Sub
End Module