I would like to write a function :
inline char separator()
{
/* SOMETHING */
}
that returns the file separator of the system in standar
The accepted answer does not work under Cygwin. Cygwin compiled programs running on Windows can use the Windows style '\' separator, but it does not define _WIN32 or the likes. A modified solution that works under Cygwin:
inline char separator()
{
#if defined _WIN32 || defined __CYGWIN__
return '\\';
#else
return '/';
#endif
}
or
const char kPathSeparator =
#if defined _WIN32 || defined __CYGWIN__
'\\';
#else
'/';
#endif