tiz

Dependents:   mas

Config.cpp

Committer:
youle1119
Date:
2016-09-14
Revision:
0:d60c26d5fddc

File content as of revision 0:d60c26d5fddc:

#include "Config.h"

Config::Config(char *filename)
{
    FILE *fp = fopen(filename, "r+");
    if(!fp)
    {
        raise_error(ERROR_CONFIG);
    }
    strcpy(this->__filename, filename);
    fclose(fp);
}

void Config::write()
{
    FILE *fp = fopen(this->__filename, "w+");
    if(!fp)
    {
        raise_error(ERROR_CONFIG);
    }
    fprintf(fp, "%d %d %d\n%d %d %d\n%d %d %d", this->__acc_offset[0], __acc_offset[1], __acc_offset[2], this->__gyo_offset[0], this->__gyo_offset[1], this->__gyo_offset[2], this->__mag_offset[0], this->__mag_offset[1], this->__mag_offset[2]);
    fclose(fp);
}