From f344629a29fe95e87ebdd6b7b97d434c4fe56731 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 16 Jul 2020 17:31:54 -0400 Subject: [PATCH] simplify --- src/write_restart.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/write_restart.cpp b/src/write_restart.cpp index f551ec96f3..c9fa2f3cdf 100644 --- a/src/write_restart.cpp +++ b/src/write_restart.cpp @@ -612,11 +612,8 @@ void WriteRestart::file_layout(int send_size) void WriteRestart::magic_string() { - int n = strlen(MAGIC_STRING) + 1; - char *str = new char[n]; - strcpy(str,MAGIC_STRING); - fwrite(str,sizeof(char),n,fp); - delete [] str; + std::string magic = MAGIC_STRING; + fwrite(magic.c_str(),sizeof(char),magic.size()+1,fp); } /* ---------------------------------------------------------------------- */