Click here to Skip to main content
15,891,833 members
Articles / Programming Languages / C++
Article

Scan and Merge INI Files

Rate me:
Please Sign up or sign in to vote.
4.71/5 (5 votes)
25 May 2000 73.9K   1.5K   22   7
A free tool to merge INI files, check for common INI file mistakes, and quickly determine how two INI files differ.
  • Download source files - 21 Kb
  • Introduction

    This utility was written late at night at a customer site to help me determine the difference between INI settings on a machine that was configured correctly and a machine that was not executing an application correctly. Originally, it just sorted two INI files so that they could easily be compared using Windiff.exe.

    It has been expanded to do the following additional tasks:

    • Find syntax errors related to comment fields in an INI file.
    • Find duplicate section blocks in an INI file.
    • Find duplicate keys within section blocks of an INI file.
    • Sort INI files so that you can use Windiff.exe to see how they differ.
    • Merge two INI files into a third.
    • Replace system paths like "C:\Windows\" with "C:\Winnt\" when it is appropriate.


    How to use it

    Just run the exe from a command line to see example usage and documentation. The basic format is as follows:

    C:\Mytools\MergeINIFiles.exe "C:\DominantFile.INI C:\Suplimental.INI C:\Merged.INI"

    Because we mostly launch this tool via InstallShield, there is no GUI, unless the files contain errors or the parameters are incorrect.


    Technology used

    The INI files are read as text files so that comments are included in the result set. The program is a simple, CFile reads the text, CArray holds the text and CMap compares the text.


    Summary

    I maintain no rights or restrictions on this code. It was not plagiarized from any other source. This utility was written using a Wizard generated SDI framework. It was created using VC 5.0.


    License

    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here


    Written By
    United States United States
    This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

    Comments and Discussions

     
    GeneralMy vote of 1 Pin
    aenagy9-Jan-09 10:21
    aenagy9-Jan-09 10:21 
    GeneralThe system cannot execute the specified program. Pin
    aenagy9-Jan-09 10:17
    aenagy9-Jan-09 10:17 
    QuestionHow to compile? Pin
    aenagy9-Jan-09 3:16
    aenagy9-Jan-09 3:16 
    AnswerRe: How to compile? Pin
    aenagy9-Jan-09 9:54
    aenagy9-Jan-09 9:54 
    I have my answer. VisualStudio 2005 was able to use the ".dsp" file as a project file. The source compiled from within the VC2005 GUI with some warnings, but completed successfully. I can run the resulting ".exe" file with no parameters and it produces a window with some help information.

    Warnings:

    ...\mergeinifilesview.cpp(359) : warning C4244: 'initializing' : conversion from 'ULONGLONG' to 'unsigned int', possible loss of data
    ...\mergeinifilesview.cpp(360) : warning C4244: 'argument' : conversion from 'ULONGLONG' to 'size_t', possible loss of data
    ...\mergeinifilesview.cpp(361) : warning C4244: 'argument' : conversion from 'ULONGLONG' to 'UINT', possible loss of data

    Smile | :)
    QuestionEXE Download? Pin
    grantwic10-Sep-06 18:42
    grantwic10-Sep-06 18:42 
    AnswerRe: EXE Download? Pin
    dllmrobinson9-Dec-08 21:42
    dllmrobinson9-Dec-08 21:42 
    GeneralRe: EXE Download? Pin
    jacko900021-Jul-16 1:26
    jacko900021-Jul-16 1:26 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.