I have a destination path and a file name as strings and I want to concatenate them with C++.
Is there a way to do this and let the program/compiler choose between /
and \
for Windows or Unix systems?
If you wanted to do it at compile time you could certainly do something like
#ifdef WIN32
#define OS_SEP '\\'
#else
#define OS_SEP '/'
#endif
Or you could just use '/' and things will work just fine on windows (except for older programs that parse the string and only work with '\'). It only looks funny if displayed to the user that way.