2015. 8. 4. 11:31ㆍProgramming/VB.NET
Imports System.IO
Module M_LogFile
Public Sub File_Write(ByVal sSet_Log As String)
Dim FPath As String
Dim FName As String
Dim FDate As String
Dim FsLog As StreamWriter
FDate = DateTime.Now.ToString
FDate = FDate.Substring(0, 11)
FName = "Log_" + FDate + ".ini"
FPath = Path.GetFullPath(FName)
If File.Exists(FPath) = False Then
FsLog = File.CreateText(FPath)
Else
FsLog = File.AppendText(FPath)
End If
Log(sSet_Log, FsLog)
FsLog.Close()
End Sub
Public Sub Log(ByVal logMessage As String, ByVal FsLog As TextWriter)
'FsLog.WriteLine(ControlChars.CrLf & "Log Entry: ") 줄바꿈 문자
FsLog.WriteLine(logMessage)
FsLog.Flush()
End Sub
End Module
' 사용법은
' File_Write("파일쓰기")
'Programming > VB.NET' 카테고리의 다른 글
VB.NET_기본 입출력 (0) | 2015.08.04 |
---|