I doubt whether you want to do this. In Linux only few files write directly to a file; output to the console is much more common and handier.
You might want to use pipe/redirection by running a program, followed by a ">" followed by the output file.
for example:
decode bla.fit
produces console output, but
decode bla.fit > output.csv
produces a output text file named output.csv
In this example you'll find more use for your tool.
I'm no C# programmer but in any C-like/Pascal/Java program there is an interface to command-line parameters.
for example:
int main(int argc, char* argv[]) {
...}
argv[0] is the name of the program itself, if
argc > 0
then you can additional arguments with
argv[i]
What you need is an extra class, that handles the messages accordingly by writing them to a file. Something like:
class FileOutputListener implements (ListenerA, Listener B, etc){
FileOutputListener(String aFilename) {
Filename = aFilename;
Outputfile = ofstream.create(Filename, access modes bla);
}
//destructor, closing, freeing.
protected:
string Filename;
ofstream Outputfile;
OnMesg(const MessageType& Msg) {
Outputfile << Msg.getHeartRate() << "...";
}
}
So you initialize the new listener with the filename.