Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Simple Os Checker
Index -> Programming, C -> C Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
bfh




PostPosted: 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;
}
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: 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?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
bfh




PostPosted: 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
Display posts from previous:   
   Index -> Programming, C -> C Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: