#include <stdio.h>
#include "configFile.h"

int main()
{
  int houseNumber;
  bool sunnyDay;
  char streetName[96];
  double temperature;

  // define the option entries and link them to C variables
  ConfigFile configFile;
  configFile.addOption("houseNumber", &houseNumber);
  configFile.addOption("sunnyDay", &sunnyDay);
  configFile.addOptionOptional("streetName", streetName, "Unknown");
  configFile.addOption("temperature", &temperature);

  // open the configuration file, and read the values
  int code = configFile.parseOptions("configFile-example.config");
  if (code != 0)
  {
    printf("Error parsing options.\n");
    return 1;
  }

  // the C variables now contain values read from the file 
  
  // we could use this to print the read values to the screen (optional)
  // configFile.printOptions();

  // now, do something with the values that were read
  printf("Your address is %d %s.\n", houseNumber, streetName);
  printf("It is a %s day.\n", sunnyDay ? "sunny" : "rainy");
  printf("The temperature is %f degrees C.\n", temperature);

  return 0;
}