[Home]ConfigurationFormatCritera

Last edit: on May 4, 2004 12:03 (4740 days, 5 hours and 43 minutes ago) (diff)
Yacff.Gratiswiki.Dk | RecentChanges | Preferences | GratisWiki

Configuration File Format Criteria

From the user's perspective

From the programmer's perspective

   try
       let cfg =
           Config.read_file "my_config_file_name.cfg" in
       let setting1 =
           do_something_with_setting1 (Config.get_int cfg "group.setting1")
       and setting2 =
	   Config.get_int cfg "group.setting2"
       and
           ...
   with
     [ Config.Option_error name reason ->
          printf "Error reading option %s: %s\n" name reason;
          exit 1
      Config.Parse_error reason ->

          printf "Error parsing configuration file %s: %s\n" reason;
	  exit 1
     ]

(side note: If the program itself finds that an option has an invalid value it is also free to raise Config.Option_error with an appropriate reason string.)


Edit text of this page | View other revisions | Download Yacff.gratiswiki.dk
Search:
GratisWiki hostes af HOW