自己回顾一下,看看有什么问题
// Copy right Big Bug, all right reserved.
// appdata.cpp
#include "appdata.h"
#include "applogger.h"
#include "iniparser.h"
#include "stdio.h"
extern AppLogger logger;
extern AppIniParser iniParser;
AppData::AppData()
{
targetNumber = 0;
topBound = 0;
bottomBound = 0;
}
AppData::~AppData()
{
}
void AppData::setData()
{
char buffer[10000];
// Get data from command line console
printf("\nExpected matched number : ");
fflush(stdin);
fgets(buffer, sizeof(buffer), stdin);
targetNumber = (float)atof(buffer);
printf("Offset value : ");
fflush(stdin);
fgets(buffer, sizeof(buffer), stdin);
topBound = (float)atof(buffer);
bottomBound = 0 - topBound;
//printf("Please input the source data : ");
printf("Please input the value : ");
fflush(stdin);
fgets(buffer, sizeof(buffer), stdin);
char tmp [100];
int j = 0;
for(int i = 0; i < (int)strlen(buffer); i++){
if(buffer[i] == ' ' || buffer[i] =='\n' || buffer[i] == '\r'){
tmp[j] = '\0';
if((int)strlen(tmp) != 0){
dataVector.push_back((float)atof(tmp));
}
tmp[0] = '\0';
j = 0;
}else{
tmp[j++] = buffer[i];
}
}
return;
}