Jump to content

Reading from an INI


anitdude
 Share

Recommended Posts

Hi,

I have a bit of a problem.

I have defined my ini file as a global constant, and to do some tests, I created a section and a few items in it, the values within the test section are 1=1 = msg 1 and 2=2 = msg 2 and so on, so I can see that my variables work. Additionally, I added a read section and create an error msg if not found. For a bizzar reason, I get the error on some sections and not others. This is somewhat frustrating and I dont seem to see why. Anyway, for the most part this works. Maybe there are some clues for troubleshooting why?

My next problem if adding a looping array, where a function will loop through a section executing the same task until there are no more items in the section. I don't see to be able to get my head around this.

An example, all hosts where the hostname is called from a secection and then a referenced section with the hostname has the things to do e.g. FIRSTTHING create a directory and SECONDTHING, copy stuff to that directory.

[HOSTS]

Hostname1=1

Hostname2=1

[HOSTNAME1]

1=FIRSTTHING

2=SECONDTHING

If there a simple way to achieve this, it would be awesome.

Link to comment
Share on other sites

  • Moderators

or a bizzar reason, I get the error on some sections and not others. This is somewhat frustrating and I dont seem to see why.

We cannot see why, either, as you did not post your code. Please post the code you're using to read through the ini, so we can attempt to reproduce.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...