Handling .ini files with pure harbour code.

267 views
Skip to first unread message

Pete

unread,
Nov 11, 2014, 2:11:39 PM11/11/14
to harbou...@googlegroups.com
Hi all,

the other day i had a need to deal with some *.ini files.
After doing a (sort of) thorough[*] search, i finally discovered
some hb_ini* core functions and  a harbour\tests\parseini.prg.
They are a very limited set not really convenient and not easy to use
but was/is a good base to start with. The result was an other set of functions
(again limited but one can now perform typical operations with *.ini files in a more
convenient and easy understandable way).(I think...)
Not a big deal, but I post them here (attached) in the hope it'd be useful
and maybe they could enhanced/completed (and possibly corrected) by someone else,
in which case the one who would do that, should, hopefully, have the kindness
to share back his improvements. ;-)

-------
[*] And then, when I had done more than half of the work I found, unexpectedly, an excellent "ini" class
inside C:\Harbour\extras\guestbk\_inifile.prg.
[and why, please, I had not located it before? because i was 'greping' my local Viktor's fork repository
from which the \guestbk\* is missing. grr! ;->]


rgrds,
Pete

ini.7z

vszakats

unread,
Nov 11, 2014, 3:32:57 PM11/11/14
to harbou...@googlegroups.com


On Tuesday, November 11, 2014 8:11:39 PM UTC+1, Pete wrote:
Hi all,


------
[*] And then, when I had done more than half of the work I found, unexpectedly, an excellent "ini" class
inside C:\Harbour\extras\guestbk\_inifile.prg.
[and why, please, I had not located it before? because i was 'greping' my local Viktor's fork repository
from which the \guestbk\* is missing. grr! ;->]

Pete

unread,
Nov 12, 2014, 3:57:33 AM11/12/14
to harbou...@googlegroups.com

On Tuesday, November 11, 2014 10:32:57 PM UTC+2, vszakats wrote:

Perhaps grep was broken.

or perhaps, 'bad karma!' <g>
(which translates to "i must was doing sth odd" given that 'grepWin',
which i do use for some years now seems to work quite well.)
the sure thing is that, indeed, guestbk family .prgs (which include the TIniFile class)
is inside \harbourV\tests\* ; however their 'raw' placement in there, can lead to 'dis-correlation'[*].
anyway, the surest thing is that i must put, ASAP, the two repositories that are now
one below the other, as far as possible far away -probably in different partitions,
to avoid confused manipulation. thanks for the pointing out.

[*] i think it could be a useful thing to have harbour\tests\* prgs, grouped into suggestively named
subdirectories based on the 'subject' they are referring to.

rgrds,
Pete


Fred Philip

unread,
Nov 20, 2014, 8:49:10 AM11/20/14
to harbou...@googlegroups.com
Hi Pete,
 
We're using since 2004 program code with a set of functions to read and update INI files (written for Cl*pper).
The code originally written by a "Peter Townsend" and it was in the public domain.
 
If interested, please leave a post here and I can upload the code.
 
HTH
 
Fred

On Tuesday, November 11, 2014 2:11:39 PM UTC-5, Pete wote:

Qatan

unread,
Nov 20, 2014, 10:05:58 AM11/20/14
to harbou...@googlegroups.com
Hello Fred,
 
Sure, please upload the code.
There is a Harbour equivalent of it on the core lib:
 
hb_iniRead()
hb_iniReadStr()
hb_iniSetComment()
hb_iniWrite()
hb_iniWriteStr()
 
Look the test file in \tests\parseini.prg
 
But it is always interesting to see other solutions.
Regards,
 
Qatan
--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users

---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Pete

unread,
Nov 21, 2014, 5:27:47 AM11/21/14
to harbou...@googlegroups.com
Hello Fred,

Thanks for you reply and willingness to present your solution.
Sure I'm interested and you may upload it here to become available for everyone.
Always, an alternative (or even better, more than one, if possible) approach about a case
is undoubtedly useful.


PS: the name "Peter Townsend" last time i looked at "The Harbour Crew"
was among the crew-list. that is, he was an early harbour contributor and very likely
some people here should know him; the "sure" thing is: "programmers leave, the code stays" ;-)


regards,
Pete
Reply all
Reply to author
Forward
0 new messages