One easy way to do what you asked is to have a small (possibly built-in) function that uses preprocessing magic to determine the platform ( #ifdef WIN32 , etc.) and returns the corresponding delimiter character.
The answer is a bit more complicated because there are other more significant differences than the delimiter character. Windows file systems can have several roots (C: \, D: \, etc.), and the whole FS is bound to / in Unix-land.
The best advice might be to use boost::filesystem .
Drew hall
source share