I am looking for a simple example on how to copy a file from one directory to another in C. The program should only use cross platform functions that are native to C.
Another alternative is something like this:
#ifdef SOME_OS
#define COPY_STR "copy %s %s" // some sort of OS-specific syntax
#elif defined SOME_OTHER_OS
#define COPY_STR "%s cpy %s" // some sort of OS-specific syntax
#else
#error "error text"
#endif
...
#include //sprintf()
#include //system()
char copy_str[LARGE_ENOUGH];
char* source;
char* dest;
...
sprintf (copy_str, COPY_STR, source, dest);
system (copy_str);