Mentions légales du service

Skip to content
Snippets Groups Projects
Commit cf3b6cdf authored by David Parsons's avatar David Parsons
Browse files

make chromosome_file_name a string

parent 676384c4
No related branches found
No related tags found
No related merge requests found
......@@ -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 : {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment