cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Randy40
Level 4

Adding to section-less INI file

Hello, I am using WriteProfString() to try and add a key=value statement to an ini file. But the ini file does not have any sections, only statements. Using WriteProfString() I notice that the write fails to occur on the section-less ini file. Is it possible to write into a section-less ini file? Any help would be appreciated. Thank you.

Regards,

Randy
Labels (1)
0 Kudos
(3) Replies
Cary_R
Level 11

Hi Randy,

My thought is that if it lacks sections, it's not truly an *.ini file, and you'd be better served using FileGrep/FileInsertLine.

Fortunately, this is not too hard to switch over to.

--Cary
0 Kudos
Randy40
Level 4

Thanks for your reply Cary. I agree that ini files generally are divided into sections, but this is considered an ini by our app developers anyway. I am going to try the FileGrep/FileInsertLine method you refer to. Thanks again for your reply.

Randy
0 Kudos
Randy40
Level 4

Hello, just in case anyone runs into this same issue and is looking for a solution, Cary's suggestion did the trick it. Using FileGrep to search a line number, and then inserting text using FileInsertLine, overcomes the "section-less" text file issue. Thanks again Cary.

Randy
0 Kudos