avoid sprintf

This commit is contained in:
Axel Kohlmeyer
2023-01-07 07:45:11 -05:00
parent fb3180eae8
commit 141a6208a9

View File

@ -1598,14 +1598,9 @@ void MinHFTN::open_hftn_print_file_()
int nMyRank;
MPI_Comm_rank (world, &nMyRank);
char szTmp[50];
sprintf (szTmp, "progress_MinHFTN_%d.txt", nMyRank);
_fpPrint = fopen (szTmp, "w");
if (_fpPrint == nullptr) {
printf ("*** MinHFTN cannot open file '%s'\n", szTmp);
printf ("*** continuing...\n");
return;
}
auto szTmp = fmt::format("progress_MinHFTN_{}.txt", nMyRank);
_fpPrint = fopen (szTmp.c_str(), "w");
if (_fpPrint == nullptr) return;
fprintf (_fpPrint, " Iter Evals Energy |F|_2"
" Step TR used |step|_2 ared pred\n");