// 
// File name: Config.cpp
//
// Discription: Описание методов класса Конфигурация
//
// Programmer: Vladimir P. Stasevich (SV)
//
// History: 
//    Created 24.02.2000 (SV)
//

#include "Config.h"

TConfig config;

int TConfig::SaveToFile
(
   const char *fileName
)
{
   FILE *fp;
   fp = fopen( fileName, "wt" );
   
   if( fp == NULL ) 
      return 1;
   
   fprintf( fp, "+Fx Mistake%u", fxMistake );
   fprintf( fp, "\n+Fz Mistake%u", fzMistake );
   fprintf( fp, "\n+My Mistake%u", myMistake );

   strcpy( name, fileName );

   fclose(fp);
   return 0;
}

int TConfig::LoadFromFile
(
   const char *fileName
)
{
   FILE         *fp;
   fp = fopen( fileName, "rt" );
      
   if( fp == NULL ) 
      return 1;
      
   fscanf( fp, "+Fx Mistake%u\n", &fxMistake );
   fscanf( fp, "+Fz Mistake%u\n", &fzMistake );
   fscanf( fp, "+My Mistake%u\n", &myMistake );

   strcpy( name, fileName );

   fclose(fp);
   return 0;
}
