Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
"ini' files: NEED ADVICE on how to add fields to efficiently
#1
Hello!

The short version of this question is: 'What is the most efficient way to append a set of fields to an existing 'ini file'?

I am using an 'ini' file something like a 'primary key' and for every transaction in my research a GUID will be generated and a log for this will be made in an 'ini' file.

Gintaras, what I am after is the most efficient way to do this or the 'quickest'

Here is what is happening:

I have an ini file that will start like this:

[0]_PkID#=0
[0]_PkID_GUID=
[0]_PkID_Cit#=
[0]_PkID_DateOfCreation=
[0]_PkID_DefaultFilePath=
[0]_PkID_ShtComment=

SUCH THAT when the first research transaction is created along with its GUID the above becomes:
(note that each "0" is incremented by 1)

[1]_PkID#=1
[1]_PkID_GUID={EE30CADD-F65F-4635-AFB9-3E20ED24B94E}PkID
[1]_PkID_Cit#=20160704152046
[1]_PkID_DateOfCreation=20160704
[1]_PkID_DefaultFilePath=24k-DB_Thoughts
[1]_PkID_ShtComment=any comment I might add upon creation

THEN WHEN THE 2nd transaction takes place, the contents of the 'ini file' become:

[1]_PkID#=1
[1]_PkID_GUID={EE30CADD-F65F-4635-AFB9-3E20ED24B94E}PkID
[1]_PkID_Cit#=20160704152046
[1]_PkID_DateOfCreation=20160704
[1]_PkID_DefaultFilePath=24k-DB_Thoughts
[1]_PkID_ShtComment=any comment I might add upon creation
[2]_PkID#=2
[2]_PkID_GUID={AA34CADD-F65F-4635-AFB9-3E20ED24B94E}PkID
[2]_PkID_Cit#=20160704152055
[2]_PkID_DateOfCreation=20160704
[2]_PkID_DefaultFilePath=24k-DB_Quote
[2]_PkID_ShtComment=and this will have its own comment if needed

SO What I am basically doing is add a new set of 'ini-elements' that increment by one number

SO MY QUESTION IS: what is the most efficient way to add a set of fields to an ini file?

I know how to take the 'last number used' and increment this by one and then update a file that contains this data set. Would I then use 'xxx.setfile' to update or append to the end of the existing ini file? (After that I would us QM's ini commands to update the new 'ini entries.)

Again, my concern is efficiency and speed.

If you have any questions & then suggestions, I would truly appreciate it.

Kent
#2
To read/write ini files can be used rget/rset and str.getfile/str.setfile, I don't have other ideas. To measure code speed:

Macro Macro2704
Code:
Copy      Help
rep 5
,PerfFirst
,rget ..
,rset ...
,...
,PerfNext
,s.getfile...
,...
,s.setfile...
,PerfNext
,PerfOut
#3
THANKS! -just wanted to be sure that I was not missing something!


Forum Jump:


Users browsing this thread: 1 Guest(s)