Category : C++ Source Code
Archive   : CPP_GRPH.ZIP
Filename : CONFIG.CPP

 
Output of file : CONFIG.CPP contained in archive : CPP_GRPH.ZIP
#include "config.hpp"

Configuration::Configuration()
{
// load the configuration data from disk
if ( (fp = fopen(CONFIGURATION_FILENAME,
"r") ) != NULL)
UseConfigurationFile();
else
UseDefaults();
}


Configuration::~Configuration()
{
// setup an error box, just in case
BOX_TYPE box;
box. x1 = 100;
box. y1 = 100;
box. x2 = 300;
box. y2 = 200;
Legend error_message;

// save the configuration data to disk
if ( (fp = fopen(CONFIGURATION_FILENAME,
"w") ) == NULL)
error_message. Center(&box, BRIGHT_RED,
"Can't save settings");

// attempt to write all the settings
if (fwrite(&RecorderSettings,
sizeof(RecorderData), 1, fp) != 1)

// something went wrong
error_message. Center(&box, BRIGHT_RED,
"Can't save settings");
}

void Configuration::UseConfigurationFile()
{
// attempt to read all the settings
if (fread(&RecorderSettings,
sizeof(RecorderData), 1, fp) != 1)

// disk may have bad data
UseDefaults();
}

void Configuration::UseDefaults()
{
RecorderData *recorder_dp = &RecorderSettings;
recorder_dp->tape_state = 0;
recorder_dp->fader = 0.5;
recorder_dp->signal_level = 0;
recorder_dp->bass = 0.5;
recorder_dp->treble = 0.5;
recorder_dp->source = 0;
recorder_dp->defeat = 0;
}


  3 Responses to “Category : C++ Source Code
Archive   : CPP_GRPH.ZIP
Filename : CONFIG.CPP

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/