Skip to content

An example of how to check the operating system and run different code in the same source code.

License

Notifications You must be signed in to change notification settings

MattiaCacciatore/Check-Operative-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Check-Operative-System

How to check the operating system (aka OS) and run different code from the same source code.

Usage

Show instructions
  1. Download and compile:
$ g++ -std=c++11 main.cpp unix_functions.cpp windows_functions.cpp -o CheckOS

$ ./CheckOS

Motivation

I needed a way to determine which is the OS where the code is being compiled FROM THE SOURCE CODE (if it's possible), this can be helpful for those projects/programs that need to operate on multiple OS.

Why

So i (and you) can easily write one code.

Problem solved

Need to write different source code for different OS.

Knowledge

The importance and utility of system MACROS.

Improvable

Yes, definitely.

About

An example of how to check the operating system and run different code in the same source code.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages