Write.ini

Language

Public Function ReadIniValue(INIpath As String, KEY As String, Variable As String) As String Dim NF As Integer Dim temp As String Dim LcaseTemp As String Dim ReadyToRead As Boolean AssignVariables: NF = FreeFile ReadIniValue = "" KEY = "[" & LCase$(KEY) & "]" Variable = LCase$(Variable) EnsureFileExists: Open INIpath For Binary As NF Close NF 'SetAttr INIpath, vbArchive LoadFile: Open INIpath For Input As NF While Not EOF(NF) Line Input #NF, temp LcaseTemp = LCase$(temp) If InStr(LcaseTemp, "[") 0 Then ReadyToRead = False If LcaseTemp = KEY Then ReadyToRead = True If InStr(LcaseTemp, "[") = 0 And ReadyToRead = True Then If InStr(LcaseTemp, Variable & "=") = 1 Then ReadIniValue = Mid$(temp, 1 + Len(Variable & "=")) Close NF: Exit Function End If End If Wend Close NF End Function

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:

1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Add new comment