Has anyone got a code snippet to separate out the path components, ie drive,
path, filename, and extension ?
No, there is no portable way to do that.
Standard C does not place any interpretation upon filenames
passed to the Standard I/O library functions, and has no idea
what a "drive", "path", or "extension" is. Standard C also has
no idea of what character or characters are used to seperate
the various components, including having no opinion on the very
existance of directories let alone the directory seperator.
Furthermore, with Microsoft's NTFS filesystem, the old drive lettering
system is superceeded, and drive names there can look like directory
names; NTFS also supports virtual mount points, so what -looks- like
a file X in directory Y might in fact be program Y with
command argument X. This use of Alternate Data Streams is not
distinguished in any syntactic way.
There are valid Unix file names that look -exactly- the same
as some valid MS Windows file names, and yet have completely
different interpretation. Then there's openVMS, and MVS, and lots
of other strange filesystem naming schemes. Oh yes and remember
that in MacOS (before MacOS X) that ':' was the directory seperator...