home *** CD-ROM | disk | FTP | other *** search
/ Aminet 15 / Aminet 15 - Nov 1996.iso / Aminet / dev / misc / ConfigLib2.lha / ConfigLibrary / Docs / Config.doc next >
Encoding:
Text File  |  1996-09-07  |  4.9 KB  |  175 lines

  1.  
  2. TABLE OF CONTENTS
  3.  
  4. config.library/WriteConfig
  5. config.library/WriteConfigNumber
  6. config.library/ReadConfig
  7. config.library/ReadConfigNumber
  8.  
  9. config.library/WriteConfig
  10.  
  11.     NAME
  12.     WriteConfig -- write an item of data to a configuration file
  13.  
  14.     SYNOPSIS
  15.     int r = WriteConfig(filename, section, item, data);
  16.                            D0        D1     D2    D3
  17.  
  18.     char *filename;
  19.     char *section;
  20.     char *item;
  21.     char *data;
  22.  
  23.     FUNCTION
  24.     Writes the data to the specified config file, in the specified
  25.     section, using the specified item keyword.
  26.  
  27.     If the config file does not exist, WriteConfig() will create it.
  28.     If the section doesn't exist, it'll be created. If the item
  29.     doesn't exist, it'll be added to the appropriate section; otherwise
  30.     the existing data for the item will be overwritten with the new
  31.     data.
  32.  
  33.     EXAMPLE
  34.     r = WriteConfig("Test.cfg","RecentFiles","File1","SYS:Data");
  35.  
  36.     INPUTS
  37.     filename    - Name of the file to write config data to
  38.     section        - Name of the section within the file
  39.     item        - Name of the item within the section
  40.     data        - Data to be written to the config file
  41.  
  42.     RESULTS
  43.     If everything works, returns CFG_WRITE_SUCCESS. In the event of
  44.     problems, returns CFG_WRITE_FAIL.
  45.  
  46.     SEE ALSO
  47.     WriteConfigNumber()
  48.  
  49. config.library/WriteConfigNumber
  50.  
  51.     NAME
  52.     WriteConfigNumber -- writes a long integer to a configuration file
  53.  
  54.     SYNOPSIS
  55.     int r = WriteConfigNumber(filename, section, item, data);
  56.                                  D0        D1     D2    D3
  57.  
  58.     char *filename;
  59.     char *section;
  60.     char *item;
  61.     long data;
  62.  
  63.     FUNCTION
  64.     Writes the long integer to the specified config file, in the
  65.         specified section, using the specified item keyword.
  66.  
  67.     If the config file does not exist, WriteConfig() will create it.
  68.     If the section doesn't exist, it'll be created. If the item
  69.     doesn't exist, it'll be added to the appropriate section; otherwise
  70.     the existing data for the item will be overwritten with the new
  71.     data.
  72.  
  73.     EXAMPLE
  74.     r = WriteConfigNumber("Test.cfg","RecentFiles","RecentCnt",4);
  75.  
  76.     INPUTS
  77.     filename    - Name of the file to write config data to
  78.     section        - Name of the section within the file
  79.     item        - Name of the item within the section
  80.     data        - Long integer to be written to the config file
  81.  
  82.     RESULTS
  83.     If everything works, returns CFG_WRITE_SUCCESS. In the event of
  84.     problems, returns CFG_WRITE_FAIL.
  85.  
  86.     SEE ALSO
  87.     WriteConfig()
  88.  
  89.  
  90. config.library/ReadConfig
  91.  
  92.     NAME
  93.     ReadConfig -- read an item of data from a configuration file
  94.  
  95.     SYNOPSIS
  96.     int r = ReadConfig(filename, section, item, buffer, bufsize, default);
  97.                           D0        D1     D2     D3       D4       D5
  98.  
  99.     char *filename;
  100.     char *section;
  101.     char *item;
  102.     char *buffer;
  103.     int bufsize;
  104.     char *default;
  105.  
  106.     FUNCTION
  107.     Reads data from a configuration file, placing it in to your buffer.
  108.  
  109.     If for any reason the data cannot be read (config file doesn't
  110.     exist, specified section doesn't exist, specified item can't be
  111.     found within the section), the default value will be copied to your
  112.     buffer, and CFG_READ_SUCCESS will be returned. You don't need to
  113.     worry about whether config files/sections/items actually exist.
  114.  
  115.     EXAMPLE
  116.     r = ReadConfig("Test.cfg","RecentFiles","File1",buf,BUFSIZE,"RAM:Test");
  117.  
  118.     INPUTS
  119.     filename    - Name of the file to read config data from
  120.     section        - Name of the section within the file
  121.     item        - Name of the item within the section
  122.     buffer        - A string buffer to receive the config data
  123.     bufsize        - The maximum size of your buffer
  124.     default        - A string to be returned if the config data cannot
  125.               be found
  126.  
  127.     RESULTS
  128.     If everything works, returns CFG_READ_SUCCESS. In the event of
  129.     problems (usually, your buffer is not large enough to receive the
  130.     configuration data), returns CFG_READ_FAIL.
  131.  
  132.     SEE ALSO
  133.     ReadConfigNumber()
  134.  
  135. config.library/ReadConfigNumber
  136.  
  137.     NAME
  138.     ReadConfigNumber -- read a long integer from a configuration file
  139.  
  140.     SYNOPSIS
  141.     long v = ReadConfigNumber(filename, section, item, default);
  142.                                  D0        D1     D2     D3
  143.  
  144.     char *filename;
  145.     char *section;
  146.     char *item;
  147.     long default;
  148.  
  149.     FUNCTION
  150.     Reads a long integer from a configuration file.
  151.  
  152.     If for any reason the data cannot be read (config file doesn't
  153.     exist, specified section doesn't exist, specified item can't be
  154.     found within the section), the default value will be returned,
  155.     and CFG_READ_SUCCESS will be returned. You don't need to worry
  156.     about whether config files/sections/items actually exist.
  157.  
  158.     EXAMPLE
  159.     v = ReadConfigNumber("Test.cfg","RecentFiles","RecentCnt",4);
  160.  
  161.     INPUTS
  162.     filename    - Name of the file to read config data from
  163.     section        - Name of the section within the file
  164.     item        - Name of the item within the section
  165.     default        - A long value to be returned if the config data
  166.               cannot be found
  167.  
  168.     RESULTS
  169.     Returns the long integer read from the config file. This function
  170.     is assumed never to fail. If the config item specified is not
  171.     numerical, 0 will be returned.
  172.  
  173.     SEE ALSO
  174.     ReadConfig()
  175.