I need a quick solution, for this simple task.
I am modifying a source code, which has this function:
OFCondition MdfDatasetManager::saveFile(const char *file_name,
E_TransferSyntax opt_xfer,
E_EncodingType opt_enctype,
E_GrpLenEncoding opt_glenc,
E_PaddingEncoding opt_padenc,
OFCmdUnsignedInt opt_filepad,
OFCmdUnsignedInt opt_itempad,
OFBool opt_dataset)
Inside the function, there is a line:
result = dfile->saveFile(file_name, opt_xfer, opt_enctype, opt_glenc,
opt_padenc,
OFstatic_cast(Uint32, opt_filepad),
OFstatic_cast(Uint32, opt_itempad),
(opt_dataset) ? EWM_dataset : EWM_fileformat);
See the file_name variable?
I want to modify, so the file_name will have ".out" added at the end.
So, I added a new variable:
char *output_file;
And before calling the dfile->saveFile() function, I added:
strcpy(output_file, file_name);
strcat(output_file, ".out");
result = dfile->saveFile(output_file, opt_xfer, opt_enctype, opt_glenc,
opt_padenc,
OFstatic_cast(Uint32, opt_filepad),
OFstatic_cast(Uint32, opt_itempad),
(opt_dataset) ? EWM_dataset : EWM_fileformat);
But, that does not work.
The application crash. And I think, the issue is I need to initialize the *output_file ?
The thing is, I am not C++ programmer :(
So, could anyone help?
Thanks.