Saving parameters to a file

Some programs, especially those driven by a GUI, will change TDRP parameters from within the program.

If you have changed parameters in the program, you may print the amended values out to a file for later use. To do this, use the sync() function to copy the the changes out to the parameter table and the print() function to print to a file.

Example using the C API:

  /*
   * copy params back to table
   */

  _tdrp_sync();

  /*
   * print out to params.out
   */

  if ((out = fopen("params.out", "w")) == NULL) {
    fprintf(stderr, "ERROR\n");
    fprintf(stderr,
	    "Cannot open file params.out for writing table.\n");
    return (-1);
  }
  _tdrp_print(out, PRINT_SHORT);
  fclose(out);

Example using the C++ API:

  Params *params;

  // copy params back to table

  _params->sync();

  // print out to params.out

  if ((out = fopen("params.out", "w")) == NULL) {
    fprintf(stderr, "ERROR\n");
    fprintf(stderr,
	    "Cannot open file params.out for writing table.\n");
    return (-1);
  }
  _params->print(out, PRINT_SHORT);
  fclose(out);