Creating .INI Files

Product Version(s): 3.31
Operating System:   MS-DOS
Flags: ENDUSER |
Last Modified: 24-FEB-1988    ArticleIdent: Q11412

Question:
   I am very impressed with the file initialization that Windows uses
(i.e., the concept of the .INI file). I would like to incorporate this
concept into my project (HTLV-III screening) application, so that it
will be more consistent with the Microsoft setup. Will Microsoft
consider releasing more technical information about the setup?

Response:
   There is no detailed technical information available at this time.
However, the basic ideas are straightforward: you set an environment
variable that contains the directory name where the .INI file is
located. Your program accesses this .INI file to find the
user-specified parameters that customize the installation. The .INI
file can contain information for more than one product. This is done
by using keywords, contained in brackets, e.g. [KEYWORD], followed by
the switches and information needed by that program.
   With respect to specific implementation, here are brief
descriptions of some helpers that we have created for internal use to
process .INI files (we cannot give you our tools, but it should be
fairly simple to create your own):

   1. A routine that checks the environment variables (this routine
can be coded in C; there is a GETENV function that can be used to
determine the environment variables) and then searches for the .INI
file at the appropriate location.
   2. A routine that opens the .INI file and searches for the KEYWORD.
   3. A routine to process the information contained after the
keyword. One way to do this is to give the program a pointer to a
matrix that contains the fields, possible field values (you need
default values), and attributes of those values (e.g. the value must
be a character string, or if that value is "20," a certain switch is
set).
