hello, am in development serial port based application which should run on both POSIX and Windows based OS, at a first step i need to find the OS and then i will use relevant OS API to work with the serial port,so can any one suggest me how to find the OS running in C.
To Find the Operating System
Collapse
X
-
Tags: None
-
Originally posted by saranjeganhello, am in development serial port based application which should run on both POSIX and Windows based OS, at a first step i need to find the OS and then i will use relevant OS API to work with the serial port,so can any one suggest me how to find the OS running in C.
Are those the small blue ports your monitor is connected to? -
Originally posted by FirecoreSerial port?
Are those the small blue ports your monitor is connected to?
saranjegan presumably you aren't actually proposing to run the same image on both machines, you are just trying to build a portable program? You should find some compiler symbols that enable you to distinguish which platform you are compiling for.
For instance the MSVC compiler defines the symbol _MSC_VER to its version number, presence of this symbol indicates use of the MSVC compiler and therefore a Windows platform as the target.
Check you compiler documentation for the symbols it defines.Comment
Comment