I wish to write the list of all parameter values used for the current run to a parameterFile.txt in the output directory.

I have all the parameters declared in one of the header files say constants.hpp. I was trying the boost::filesystem copy_file method to merely copy the whole header "as-is" to a text file. The problem however is that if running on a remote machine, the header file is obviously not available for copying. And I do agree that dumping parameter values this way is stupid (when I can just put the header in the output).

Is there a better method to do so?

TIA, Nikhil

有帮助吗?

解决方案

Instead of storing your parameter values in a header file, have you considered passing them in at runtime?

I see you are already using boost. Boost program options may fit your needs particularly well, because as well as allowing you to specify options on the command line - you can also put all your options in a configuration file and then run your code against this.

See here: http://www.boost.org/doc/libs/1_49_0/doc/html/program_options.html

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top