
Problem using GetPrivateProfile to set current path
Quote:
> I'm calling GetPrivateProfileString to read my INI file from a
> separate module. I have to initialize the return string 'srcdir' with
> the command srcdir = String$(iLength, 0) where iLength = 255.
> The returned string, when I examine it, has a bunch of 'blank'
> characters at the end; e.g., C:\MYDIREC\_ _ _ _ _ _ _ ...
[chomp]
The return value of GetProfileString and GetPrivateProfileString
is the number of valid characters put into the buffer. Try this:
Dim r As Integer, Buf As String
Buf = String$(255, 0)
r = GetPrivateProfileString("foo", "bar", "default", Buf, Len(Buf), INIFile)
Buf = Left$(Buf, r)
--
WARNING: I cannot be held responsible for the above They're coming to
because my cats have apparently learned to type. take me away, ha ha!