- snprintf(str, sizeof(str), "nx=%d, ny=%d, nsample=%d, ", opt_nx, opt_ny, opt_nsample);
- if (opt_phmfilename[0]) {
- strncat(str, "phantom=", sizeof(str));
- strncat(str, opt_phmfilename, sizeof(str));
- }
- else if (opt_phmnum != -1) {
- strncat(str, "phantom=", sizeof(str));
- strncat(str, name_of_phantom(opt_phmnum), sizeof(str));
- }
+ ostringstream oss;
+ oss << "nx=" << opt_nx << ", ny=" << opt_ny << ", nsample=" << opt_nsample << ", ";
+ if (opt_phmfilename.length())
+ oss << "phantom=" << opt_phmfilename;
+ else if (opt_phmnum != -1)
+ oss << "phantom=" << name_of_phantom(opt_phmnum);