Bryan - Gendev
Programmer
In my new program to garble a project from a genealogy program I am attempting to read entries from an ini file which is part of that project.
When my program is run from the development folder on P: drive the output I create is
---------------------
Log of garbling on the XXX project - SAMPLE
Start of garbling run at 17:27:01 on 14/09/2017
In XXX ini file - SAMPLE.ini
RESEARCHER
Name GenDev - Removed by XXX Garble
---------------------
However when run from the C:\program files folder I get ]
---------------------
Start of garbling run at 17:29:16 on 14/09/2017
In XXX ini file - SAMPLE.ini
RESEARCHER
Name - Removed by XXX Garble <<<<<<<<<<<<<<<<<<<<<< missing entry
____________________
The contents of the Name entry is missing.
Why could this be?
The code in part is ( I've just used one entry as an example.)
When my program is run from the development folder on P: drive the output I create is
---------------------
Log of garbling on the XXX project - SAMPLE
Start of garbling run at 17:27:01 on 14/09/2017
In XXX ini file - SAMPLE.ini
RESEARCHER
Name GenDev - Removed by XXX Garble
---------------------
However when run from the C:\program files folder I get ]
---------------------
Start of garbling run at 17:29:16 on 14/09/2017
In XXX ini file - SAMPLE.ini
RESEARCHER
Name - Removed by XXX Garble <<<<<<<<<<<<<<<<<<<<<< missing entry
____________________
The contents of the Name entry is missing.
Why could this be?
The code in part is ( I've just used one entry as an example.)
Code:
lcContent = ''
cContent = ''
lcLine = ""
cMessagetext = ""
cSection = 'Researcher'
Strtofile(UPPER(cSection)+ lcCrlf, ('garble.log'),.T.)
cEntry1 = 'Name'
For lnI = 1 To 1
lcLine = Eval("cEntry" + Transform(lnI))
Wait Window UPPER(cSection)+' ' +lcLine Timeout 2
cContent = readini(inifile,'read',cSection,lcLine)
lcContent = Eval("cContent") <<<<<<<<<<<< tried as a test - same when just using cContent
Wait Window lcLine+' ' +cContent Timeout 2
If ldoit
readini(inifile,'write',cSection,lcLine,cPath)
Endif
cMessagetext = lcLine +' ' +lcContent + " " + cPath + lcCrlf
Strtofile(cMessagetext, ('garble.log'),.T.)
Endfor
Function readini
&& uses full path name for file
Parameters tcFileName,mode,tcSection, tcEntry, tcValue
Local lcValue
Declare Integer GetPrivateProfileString ;
IN WIN32API ;
STRING cSection,;
STRING cEntry,;
STRING cDefault,;
STRING @cRetVal,;
INTEGER nSize,;
STRING cFileName
Do Case
Case mode = 'read'
lcValue = ReadFileIni(tcFileName,tcSection,tcEntry)
If Isnull(lcValue)
lcValue = ''
Endif
If Vartype(lcValue)="C"
Wait Window lcValue Nowait
Endif
Endcase
Return lcValue