-
when I input a string value from an INI file, there is something tacked on to the end of it. I set the length of the returned string to 50 and used RTrim() to remove the trailing spaces, but when I go into debug mode and hover the mouse over the string it has a thick "|" on the end. What the hell is that?
Also, i looked at what the ascii value of that thick "|" was and it said it was 0.
-
Please post the code that you are using to retrieve the string.
-
Code:
Public Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationname As String, ByVal lpKeyName As Any, ByVal lsString As Any, ByVal lplFilename As String) As Long
Public Declare Function GetPrivateProfileInt Lib "kernel32" Alias "GetPriviteProfileIntA" (ByVal lpApplicationname As String, ByVal lpKeyName As String, ByVal nDefault As Long, ByVal lpFileName As String) As Long
Public Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationname As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Public Sub getSett()
Dim Temp As String * 30
ret = GetPrivateProfileString("Directories", "SharedDir", lpFileName, Temp, Len(Temp), lpFileName)
If ret = 0 Then
Beep
Else
frmMain.ShareDir = RTrim(Temp)
End If
Temp = ""
ret = GetPrivateProfileString("Directories", "DestDir", lpFileName, Temp, Len(Temp), lpFileName)
If ret = 0 Then
Beep
Else
frmMain.NewDir = RTrim(Temp)
End If
End Sub
-
GetPrivateProfileString returns the length of the string.
Here is some xode that works.
Code:
sBuffer = Space$(99)
nDummy = GetPrivateProfileString("Defaults", "IntegrationType1", "", sBuffer, 99, gsIniName)
gsDefIntegType1 = Left$(sBuffer, nDummy)