I'd like my programs to work for both a windows operating system and a mac. I know that it can not be done in a function but I want to do somehing like
I'm sure it can't be that simple, but that's the effect I'd like it to have. That way if I wanted a clear screen function, I'd make one with clrscr (); and one with system ("CLS"); put each in the correct header file then later on just type clearscreen (); and it would call the appropriate function depending on which header was included. I hope that made sence. I pretty much want to make two identical header files but they each have platform specific commands. During compile time, my source file should determine what platform it's being compiled on and #include the appropriate header file. I don't know anyway of doing this. Help is appreciated.
actually it is that simple
you use these and check for definitions that comilers put in.
the MSVC uses WIN32 to define a windows program. I'm not sure for other OSs though. Look for the preprocessor definitions for your compiler.
// include windows header
// headers of other OSs
Thanks, some things are just too obvious to realize. Like when I spent an hour making a function that does the exact same thing as one already defined in iostream. Sounds simple enough, if I have any problems with it I'll be back.