I think Duodas have posted a good example of multilevel environment recognition with subsequent macros standartisation (#define __WIN32__, for example). More complicated example from the Boost library:
http://www.boost.org/doc/libs/1_36_0...orm_config.hpp
The key point is: don't dissipate OS/compiler dependencies over all your codes. Incapsulate all this stuff in the only .h header file. Declare your own portable functions (and data structures) in this file. For example, suppose its name is omgconio.h:
#ifndef OMGCONIO_H
#define OMGCONIO_H
...
/** Explain ClrScr functionality */
void ClrScr();
int Peek();
bool KbHit();
int GetCh();
...
#endif
Use only these functions calls in your source(s).
Create omgconio.cpp file with these functions inplementation. Place all OS/compiler selecting conditional compilation directives in this file only. Add omgconio.h and omgconio.cpp files to your projects.
Now you know where is OS/compiler dependency incapsulated if you will be ready to expand or correct your platform independent direct console i/o support.