I would create a different behavior based on the system and on the way a software is launched. I'm on Windows and I use Eclipse as IDE. I would have different behaviors on the base of the OS (Linux or Windows). This should be easy to do. This is the code I founded:
#ifdef __linux__
//linux code goes here
#elif _WIN32
// windows code goes here
#else
#endif
But, I would also have a different behaviour on the base of the way I launch the software.
I mean, if I launch the software from my Eclipse, the software has to do something, if I launch it from Windows command line (cmd), another.
In my specific case, I need this type of behavior becouse I would use ncurses
lib to my output. I would have cout
stream when I lauch the software from Eclipse and ncurses output when I launch it from cmd.exe
.
Thank you for the answers.