0

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.

BossShell
  • 379
  • 3
  • 14

1 Answers1

0

One possible solution is to use a command-line parameter when you launch your program.
I.e.

> yourprogram --devmode

Launch your program with --devmode from Eclipse IDE, do not specify the parameter when launched normally from the command prompt/shell.

roalz
  • 2,699
  • 3
  • 25
  • 42