Hi,
You should define an environment variable for that. What I do under UNIX is
that I changed my .cshrc file so that it checks the current OS system. This is
because I have different compilers for Linux, Irix and Posix. My .cshrc file
looks like:
if (`uname` == IRIX) then
setenv OS linux
setenv COMPILER CC
endif
...
In your makefile - or whatever you use to compile you applications - you have
to use:
$(COMPILER) ... -D $(OS) ...
Now you can use preprocessor directives to selectively include header files
like:
#include <stdio.h>
#ifdef linux
#include <stdlib.h>
#endif
Under Windows NT there is also an environment variable called OS with the
value 'Windows_NT' ... but you can set this variable yourself for DOS as well.
I don't know which compiler you're using for Windows or DOS but if it is not
gcc or another command line compiler - which usually has the flag '-D' - then
I am sure that there is another way to pass an environment variable.
Hope this help...
Joachim
Quote:
> Is there a way I could know which operating system it's compiling on since
> some of the header files are only available for UNIX and some are only for
> DOS or Windows.
> I think there should be ome preprocessor directives or macros that'll help,
> right?? How to use those??
---------------------------------------------------------------------------
---------------------------------------------------------------------------