size of writeConfigFile

This commit is contained in:
Erik Frojdh 2018-10-11 15:19:26 +02:00
parent a28932bb6c
commit 316ba01297
2 changed files with 4 additions and 7 deletions

View File

@ -1019,27 +1019,24 @@ int multiSlsDetector::readConfigurationFile(std::string const fname) {
} }
int multiSlsDetector::writeConfigurationFile(std::string const fname) { int multiSlsDetector::writeConfigurationFile(const std::string& fname) {
std::string names[] = { const std::vector<std::string> names = {
"detsizechan", "detsizechan",
"hostname", "hostname",
"outdir", "outdir",
"threaded" "threaded"
}; };
int nvar = 15;
char* args[100]; char* args[100];
for (int ia = 0; ia < 100; ++ia) { for (int ia = 0; ia < 100; ++ia) {
args[ia] = new char[1000]; args[ia] = new char[1000];
} }
int ret = OK, ret1 = OK; int ret = OK, ret1 = OK;
std::ofstream outfile; std::ofstream outfile;
int iline = 0; int iline = 0;
outfile.open(fname.c_str(), std::ios_base::out); outfile.open(fname.c_str(), std::ios_base::out);
if (outfile.is_open()) { if (outfile.is_open()) {
auto cmd = slsDetectorCommand(this); auto cmd = slsDetectorCommand(this);
// complete size of detector // complete size of detector
@ -1066,7 +1063,7 @@ int multiSlsDetector::writeConfigurationFile(std::string const fname) {
outfile << std::endl; outfile << std::endl;
//other configurations //other configurations
while (iline < nvar) { while (iline < names.size()) {
std::cout << iline << " " << names[iline] << std::endl; std::cout << iline << " " << names[iline] << std::endl;
strcpy(args[0], names[iline].c_str()); strcpy(args[0], names[iline].c_str());
outfile << names[iline] << " " << cmd.executeLine(1, args, GET_ACTION) << std::endl; outfile << names[iline] << " " << cmd.executeLine(1, args, GET_ACTION) << std::endl;

View File

@ -475,7 +475,7 @@ public:
* @param fname configuration file name * @param fname configuration file name
* @returns OK or FAIL * @returns OK or FAIL
*/ */
int writeConfigurationFile(std::string const fname); int writeConfigurationFile(const std::string& fname);
/** /**
* Returns the trimfile or settings file name (Useless??) * Returns the trimfile or settings file name (Useless??)