The solution, which has no duplication, and does not rely on the definition of a macro (other than the one predefined for platform discovery), but has slightly more templates than the Aracthor solution:
#ifdef _WIN32
inline int access(const char *pathname, int mode) {
return _access(pathname, mode);
}
#else
#include <unistd.h>
#endif
I prefer to detect windows and use posix as a rollback because windows tend to be the exception more often than linux.
_CRT_NONSTDC_NO_WARNINGS POSIX access . strcpy strcpy_s . ( C11), , C ( _s msvc C11).