Advertisement
obernardovieira

Detect if SO is Windows or Linux

Jul 27th, 2013
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) || defined(__WINDOWS__) && !defined(__CYGWIN__)
  2.     #define OS_Windows
  3. #else
  4.     #define OS_Linux
  5. #endif
  6.  
  7. bool main() {
  8.     #ifdef OS_Windows
  9.         /* Windows code */
  10.     #else
  11.         /* GNU/Linux code */
  12.     #endif
  13.     return true;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement