Announcement

Collapse
No announcement yet.

.INI Files

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • .INI Files

    Hi,

    I have been given a program written in a macro language that uses an .INI file as below:

    [MAPPING]
    PCOMPLETED=P:\Completed Zips\
    SOURCEFILES=T:\SOURCEFILES\
    [ENCRYPT]
    PARM1=GOODBYE
    [ARCHIVES]
    PARM1=PAYROLL
    PARM2=PENSION
    PARM3=COST
    PARM4=STOP
    [ZIPNAMES]
    PARM1=COMP PAYROLL EXTRACT %MyDialog.MyEdit%.ZIP
    PARM2=COMP PENSION EXTRACT %MyDialog.MyEdit%.ZIP
    PARM3=COMP COST REPORT %MyDialog.MyEdit%.ZIP
    PARM4=STOP
    [PAYROLL]
    PARM1=T:\sourcefiles\overtime*.csv
    PARM2=T:\sourcefiles\greta2*.csv
    PARM3=T:\sourcefiles\passonly*.csv
    PARM4=T:\sourcefiles\treking*.csv
    PARM5=T:\sourcefiles\charity*.csv
    PARM6=STOP
    [PENSION]
    PARM1=T:\sourcefiles\teltest*.csv
    PARM2=T:\sourcefiles\lifp*.csv
    PARM3=T:\sourcefiles\lifd*.csv
    PARM4=T:\sourcefiles\mpcall*.csv
    PARM5=T:\sourcefiles\nonclass*.csv
    PARM6=STOP
    [COST]
    PARM1=T:\sourcefiles\costs_*.csv
    PARM2=STOP

    What would be the best way to transfer this data to use in PBWIN, is it to still use an .ini file?. I need to loop through all the files above that were generated on the day that the program is run but I'm not sure how to use the headings in the ini file.

    Thx,

    John

  • #2
    John,

    Ini files can be read in PB without any problem. Especially if you use Eros Olmis ini file functions:
    http://www.powerbasic.com/support/pb...ad.php?t=25027

    Kind regards
    Eddy

    Comment


    • #3
      And, you might also want to consider WHERE to store that INI file, if you want to avoid UAC problems writing to a protected folder:

      Let Me Tell Ya Where to Stick It by Karl Peterson

      Move That INI File!and Get That Ini File Name!
      Michael Mattias
      Tal Systems (retired)
      Port Washington WI USA
      [email protected]
      http://www.talsystems.com

      Comment


      • #4
        Also have a look at the Windows API functions GetPrivateProfileString and WritePrivateProfileString. These are very handy for easily reading and writing INI files for any given key value at any time.
        Scott Slater
        Summit Computer Networks, Inc.
        www.summitcn.com

        Comment


        • #5
          What would be the best way to transfer this data to use in PBWIN, is it to still use an .ini file?.
          As far as, "Is an INI file the best way to store program-specific data which may change from run to run?" the answer is....

          Probably. Or maybe not. Microsoft recommended INI files. Then they recommended the registry. Then they recommmended INI files. This cycle may have repeated several times.

          I use INI files. Your mileage may vary.

          (Good 'poll' question? Given your druthers, what do you currently use, INI files, Registry or "other"?)

          MCM
          Michael Mattias
          Tal Systems (retired)
          Port Washington WI USA
          [email protected]
          http://www.talsystems.com

          Comment


          • #6
            Originally posted by Michael Mattias View Post
            (Good 'poll' question? Given your druthers, what do you currently use, INI files, Registry or "other"?)
            INIs since day one, as I found it to be a good idea that one is able to view a config file with any text viewer/editor.

            P.S. Meanwhile MS itself uses XML files (app.config/web.config), which is pretty much the same: an editable text file, just a different layout.

            Comment


            • #7
              Originally posted by Michael Mattias View Post
              ( what do you currently use, INI files, Registry or "other"?)
              INI files (for the same reason as Knuth) and sometimes files using my own format, mainly if I have to store long binary data.
              But never, ever the registry. I like to keep settings (INI) files as close as possible to the application program. Too bad Vista changed all that ..

              Kind regards
              Last edited by Eddy Van Esch; 24 Feb 2009, 09:48 AM.
              Eddy

              Comment


              • #8
                Whoa, there, I do not want to be guilty of starting one of those 22-page monstrosity threads... I meant, if someone were interested, start a new thread in suitable forum using the BBS' "poll" feature.....carfully wording the question, including options I had not thought of (eg "Microsoft XML storage format").
                Michael Mattias
                Tal Systems (retired)
                Port Washington WI USA
                [email protected]
                http://www.talsystems.com

                Comment


                • #9
                  Whoa, there, I do not want to be guilty of starting one of those 22-page monstrosity threads.
                  Too late.....

                  carfully wording the question, including options I had not thought of (eg "Microsoft XML storage format").
                  "Carefully" may not be my strong suit, but does bring back questions I have had for years (from time to time) and never found the time to research long.

                  Maybe now is as good a time as ever to spurn one of those long debates and see how others go about it???? (Personally I tried both Registry and INI and stuck with INI for maintenance purposes)
                  Engineer's Motto: If it aint broke take it apart and fix it

                  "If at 1st you don't succeed... call it version 1.0"

                  "Half of Programming is coding"....."The other 90% is DEBUGGING"

                  "Document my code????" .... "WHYYY??? do you think they call it CODE? "

                  Comment

                  Working...
                  X