PDA

View Full Version : Edit INI File without sections



Wayne Freeman
04-05-2009, 04:36 PM
Hi Friedrich,

I'm supporting an existing system that has an INI file that some of my installations have to add entries to.

This INI file has no sections. When I use the Edit INI File function to add an entry or two, it precedes the new entries with an empty section header, like this:

existingentry=1
existingentry=2
bunchmore=20
[]
newentry=1
newentry=2

I wouldn't expect it to cause a problem, and it appears not to (the application reads its entries without section headers), but it looks a little strange and I'm wondering if there might be a way to get the Edit INI File function to not do that.

Thanks,

Wayne

linder
04-06-2009, 01:41 AM
Hi Wayne,

Well, a file with an empty "section header" is NOT an INI file ;)

See MSDN:
http://msdn.microsoft.com/en-us/library/ms725501%28VS.85%29.aspx

An INI file is defined as:

[Section1]
FirstKey = It all worked out okay.
SecondKey = By golly, it works.
ThirdKey = Another test.

The only way to manipulate your text file (not INI file) is to use the "Handle Text File Operation..." function.

Does this help?

Friedrich

Wayne Freeman
04-06-2009, 05:24 PM
I'm not going to try to defend them, Friedrich, but this "ini" file is generated by code descended from prehistorical times when things were less picky. :rolleyes:

Anyway, your answer was what I was expecting, and yes, it helped.

Thanks,

Wayne