This commit is contained in:
Axel Kohlmeyer
2021-03-16 00:50:10 -04:00
parent 68b6296f90
commit 3d67d1eee9
2 changed files with 4 additions and 12 deletions

View File

@ -43,11 +43,7 @@ void WriteCoeff::command(int narg, char **arg)
if (narg != 1) error->all(FLERR,"Illegal write_coeff command");
int n = strlen(arg[0]) + 5;
char *file = new char[n];
strcpy(file,"tmp.");
strcat(file,arg[0]);
char *file = utils::strdup(fmt::format("tmp.{}",arg[0]));
// initialize relevant styles
lmp->init();
@ -114,7 +110,7 @@ void WriteCoeff::command(int narg, char **arg)
const char *section = (const char *)"";
fputs(str,two); // style
utils::sfgets(FLERR,str,256,one,file,error); // coeff
n = strlen(str);
int n = strlen(str);
strcpy(coeff,str);
coeff[n-1] = '\0';
utils::sfgets(FLERR,str,256,one,file,error);