www.pudn.com > Txt-To-Image.rar > modFile.bas, change:2010-04-28,size:685b


Attribute VB_Name = "modFile" 
Option Explicit 
 
'读取文件到字符串中 
Public Function ReadFileToString(strFileName As String) As String 
    On Error GoTo ErrorTag 
    If Dir$(strFileName) = "" Then GoTo ErrorTag 
    Dim lngFileLen As Long 
    lngFileLen = FileLen(strFileName) 
    ReadFileToString = String(lngFileLen, Chr$(0)) 
    Open strFileName For Binary As #1 
    Get 1, , ReadFileToString 
    Close #1 
    Dim EndPos As Long 
    EndPos = InStr(1, ReadFileToString, Chr$(0)) 
    If EndPos > 0 Then 
        ReadFileToString = Left$(ReadFileToString, EndPos - 1) 
    End If 
    Exit Function 
ErrorTag: 
    ReadFileToString = "" 
    Exit Function 
End Function