Computer Science Canada

Simple Os Checker

Author:  bfh [ Mon Sep 13, 2010 10:37 am ]
Post subject:  Simple Os Checker

Here's a little program that tests if your Operating system is Windows or Linux.
code:

/*----------------------------
Date: Sunday 5th 2010
Purpose: Systen Checker
Creator: Paul
Modified Last: Sunday 5th 2010
----------------------------*/

#include <stdio.h>
#include <stdlib.h>

#ifdef _WIN32
     #define SYS "Windows"
#endif

#ifdef linux
     #define SYS "Linux"
#endif

main(){
     printf("\nThe Operating system That Your pc is running is: %s", SYS);
     getch();
return 0;
}

Author:  Tony [ Mon Sep 13, 2010 2:51 pm ]
Post subject:  RE:Simple Os Checker

What about OSX or Unix or any other system? Do 64 bit versions of Windows still define _WIN32?

Author:  bfh [ Mon Sep 13, 2010 8:37 pm ]
Post subject:  Re: RE:Simple Os Checker

Tony @ Mon Sep 13, 2010 2:51 pm wrote:
What about OSX or Unix or any other system? Do 64 bit versions of Windows still define _WIN32?


im running on windows 64 bit, the program will still tell u if running windows or linux

not sure about mac's yet gonna figure that out later.

not sure about unix thing though.


Edit:

I don't have a Mac so if some 1 that does will add this code after line 19
and let us know if it identifies the Os as mac

code:

#ifdef OSX
    #define SYS "Mac"
#endif


: