Is there a way to do this :
Write a C program, that when executed on a windows machine, it prints " MSWorld" and when executed on a unix machine , it prints "UNIX"
Is there a way to do this :
Write a C program, that when executed on a windows machine, it prints " MSWorld" and when executed on a unix machine , it prints "UNIX"
In the middle of difficulty, lies opportunity
You could look into using preprocessor directives to detect what O/S you're compiling on, and only compile the code for that O/S. #ifdef is probably what you want.
Not without recompiling it for the target OS as MacGyver said.
#ifndef __unix__
#error "This section will only work on UNIX systems"
#endif