|
-
Oct 21st, 2000, 01:26 PM
#1
Thread Starter
Hyperactive Member
Can an INI file have a maximum length ?
I made 2 ini files. one is only 1 page long, the other is 50 pages long. When I try to read data with the GETPRIVATEPROFILESTRING-api, it returns the correct value from the 1 page long file, but from the 50 pages long file, he returns the default("").
Code:
tmpReturn = String$(100,0)
Default = ""
'The file with 1 page
File1 = "C:\myMap\inifile1.ini"
'The file with 50 pages
File50 = "C:\myMap\inifile50.ini"
'The strTemp variable will contain the value of "Key"
strTemp = GetPrivateProfileString("Heading","Key",Default,_
tmpReturn,Len(tmpReturn),File1)
'The strTemp variable will contain ""
strTemp = GetPrivateProfileString("Heading","Key",Default,_
tmpReturn,Len(tmpReturn),File50)
WP
-
Oct 21st, 2000, 05:40 PM
#2
Try reading the 50 pages like this:
Code:
Public Function ReadINI(strsection As String, strkey As String, strfullpath As String) As String
Dim strbuffer As String
Let strbuffer$ = String$(750, Chr$(0&))
Let ReadINI$ = Left$(strbuffer$, GetPrivateProfileString(strsection$, ByVal LCase$(strkey$), "", strbuffer, Len(strbuffer), strfullpath$))
End Function
strTemp = ReadINI("Heading","Key",File50)
-
Oct 22nd, 2000, 06:02 AM
#3
Thread Starter
Hyperactive Member
difference?
So you only changed the length of strBuffer$. But my values are max 100 characters long, so...
WP
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|