diff --git a/src/aevol_create.cpp b/src/aevol_create.cpp index 952f008068a938f60c58202735176d60525ad91a..866430b409ca03fcb55fd0cc361e223d197530bc 100644 --- a/src/aevol_create.cpp +++ b/src/aevol_create.cpp @@ -58,7 +58,7 @@ void interpret_cmd_line_options(int argc, char* argv[]); // Command-line option variables static char* param_file_name = nullptr; -static char* chromosome_file_name = nullptr; +static std::string chromosome_file_name; int main(int argc, char* argv[]) { interpret_cmd_line_options(argc, argv); @@ -76,7 +76,7 @@ int main(int argc, char* argv[]) { // Initialize the simulation from the parameter file std::list<std::string> chromosomes; - if (chromosome_file_name != nullptr) { + if (chromosome_file_name.length() != 0) { std::ifstream chromosome_file(chromosome_file_name); if (not chromosome_file) { Utils::ExitWithUsrMsg(std::string("failed to open source chromosome file ") + chromosome_file_name); @@ -91,7 +91,6 @@ int main(int argc, char* argv[]) { std::cout << "Loading chromosome from text file " << chromosome_file_name << " (" << chromosomes.front().length() << " base pairs)" << std::endl; - delete [] chromosome_file_name; } if(param_file_name != nullptr) { @@ -182,8 +181,7 @@ void interpret_cmd_line_options(int argc, char* argv[]) { break; } case 'C': { - chromosome_file_name = new char[strlen(optarg) + 1]; - strcpy(chromosome_file_name, optarg); + chromosome_file_name = optarg; break; } default : {