lenna
08-21-2004, 05:30 PM
Hi,
does anybody know a library function or any other way to identify the operating system at pre compilation time (or afterwards)?
basically, I need to write a program that will run BOTH under UNIX and WINDOWS with the same code. thus I thought a good solution can be to wrap OS dependent functions under pre compilation condition, something like:
#if OS == UNIX
...use UNIX lib functions
#elseif OS == WINDOWS
...use WINDOWS lib functions
the problem I don't know how to recognize the OS at pre compilation or compilation time.
thanks,
me
does anybody know a library function or any other way to identify the operating system at pre compilation time (or afterwards)?
basically, I need to write a program that will run BOTH under UNIX and WINDOWS with the same code. thus I thought a good solution can be to wrap OS dependent functions under pre compilation condition, something like:
#if OS == UNIX
...use UNIX lib functions
#elseif OS == WINDOWS
...use WINDOWS lib functions
the problem I don't know how to recognize the OS at pre compilation or compilation time.
thanks,
me