Reading ini, but not by exact line?
VB Code:
Public Function GetSett(Section As String, Entry As String, strbuff As String, jPLace As String) As String
strbuff = String(256, 0)
c = GetPrivateProfileString(Section, Entry, _
"", strbuff, Len(strbuff), jPLace)
GetSett = Left$(strbuff, c)
End Function
Ive written this nice sub just to read an ini file, but im wondering..is it possible to read a line by an not-exact name? i could read it by regular I/O but this is much faster :wave:
Re: Reading ini, but not by exact line?
Depends. If you know the section your line is in then you can only have to read a few lines to find the partial matches. If you dont know the section then you can use File I/O to read it like a regular textfile with LOF. Then split into an array and loop line by line matching only the partials. ;)
Re: Reading ini, but not by exact line?
Well i have about 300 line file, and it has the word im searching for and a number so it will look like this in some parts
111 cat
112 cat spanish
113 cat french
etc etc..but say i need to find the line with just cat or just cat spanish? i dont really want to use regular i/o because it will waste time. Anyways, thanks :wave:
Re: Reading ini, but not by exact line?
Yes, much more faster to use the API since you only want to make the call a few times for these type of situations. ;)
Btw, why not just regroup your ini so its easier to read? What is the numbers for?