I'm using some windows api to access INI files. My code works fine unless I specify an actual path to the ini file. If I leave the path empty it will default to \windows, but all of the functions will work fine. I don't know if Vista would like that. In any case, I would rather specify my own app.path.
instead of:
i = WritePrivateProfileString ("HTWin","NotMain1","False","test.ini")
I would like to use:
i = WritePrivateProfileString ("HTWin","NotMain1","False","c"\testdir\test.ini")
In reading other posts on WritePrivateProfileString, it seems that others believe that this should also accept a full path. What am I doing wrong?
Code to follow, Thanks in advance...
'compile as console
TYPEDEF byte CHAR
TYPEDEF bool INT
TYPEDEF HANDLE UINT
def i as int
def txtScratch as STRING
DECLARE IMPORT,WritePrivateProfileString alias WritePrivateProfileStringA(string lpAppName, string lpKeyName, string lpString, string lpFileName),BOOL
Declare "kernel32",GetPrivateProfileIntA(lpAppName:String,lpKeyName:String,nDefault:Int,lpFileName:String),Int
Declare "kernel32",GetPrivateProfileStringA(lpAppName:String,lpKeyName:String,lpDefault:String,lpReturnedString:String,nSize:Int,lpFileName:String),Int
i = GetPrivateProfileStringA ("HTWin","Main","False",txtScratch,255,"test.ini")
print "len(Get) = " + str$(i)
print "Main = " + LEFT$(txtScratch,i)
i = GetPrivateProfileIntA ("HTWin","NerdCount",1,"test.ini")
print "NerdCount = " + str$(i)
print ""
i = WritePrivateProfileString ("HTWin","Main","I LIKE CHEESE!!!","test.ini")
print "resultMain = " + str$(i)
i = WritePrivateProfileString ("HTWin","NotMain","True","test.ini")
print "resultNotMain = " + str$(i)
i = WritePrivateProfileString ("HTWin","NerdCount","32","test.ini")
print "resultNerdCount = " + str$(i)
i = WritePrivateProfileString ("HTWin","Main1","False","test.ini")
print "resultMain1 = " + str$(i)
i = WritePrivateProfileString ("HTWin","NotMain1","False","test.ini")
print "resultNotMain1 = " + str$(i)
DO: UNTIL INKEY$ <> ""
Users guide->Constants and Literals->String Literals.
i = WritePrivateProfileString ("HTWin","NotMain1","False","c:\\testdir\\test.ini")
\t = tab character so \testdir would be <tab>estdir
\\testdir is \testdir
Thanks Paul,
I knew it was something simple.