Matthias Hofmann
2005-09-06 16:07:39 UTC
Hello everyone!
I wonder if there is a portable way to retrieve the platform-dependant path
separator. Windows uses '\' while Linux uses '/', and other platforms might
still use other characters. The standard says nothing about path separators,
and I found no information on the internet either.
If there is no way to tell the path separator, then can anyone please tell
me a portable way to make clients of my code aware of the problem? What I
have in mind is something like this:
#ifdef _WIN32
#define PATH_SEPARATOR "\\"
#else
#pragma message ( "Could not determine path separator." )
#endif
However, as far as I know the message pragma is not portable.
--
Matthias Hofmann
Anvil-Soft, CEO
http://www.anvil-soft.com - The Creators of Klomanager
http://www.anvil-soft.de - Die Macher des Klomanagers
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
I wonder if there is a portable way to retrieve the platform-dependant path
separator. Windows uses '\' while Linux uses '/', and other platforms might
still use other characters. The standard says nothing about path separators,
and I found no information on the internet either.
If there is no way to tell the path separator, then can anyone please tell
me a portable way to make clients of my code aware of the problem? What I
have in mind is something like this:
#ifdef _WIN32
#define PATH_SEPARATOR "\\"
#else
#pragma message ( "Could not determine path separator." )
#endif
However, as far as I know the message pragma is not portable.
--
Matthias Hofmann
Anvil-Soft, CEO
http://www.anvil-soft.com - The Creators of Klomanager
http://www.anvil-soft.de - Die Macher des Klomanagers
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]