Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>fnsplit() split a full path name into its components</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 fnsplit()               Split a Full Path Name into Its Components

 #include   <dir.h>

 int        fnsplit(path,drive,dir,name,ext);
 const char *path;                       Full name
 char       *drive;                      Drive
 char       *dir;                        Directory/subdirectory
 char       *name;                       File name
 char       *ext;                        File extension

    fnsplit() splits a pathname specified by 'path' into its four
    components.  'path' is a string in the form:

                      X:\DIR\SUBDIR\NAME.EXT

    fnsplit() then stores the components in the strings 'drive', 'dir',
    'name', and 'ext'.   These strings and their maximum lengths are
    given by the following constants (defined in <dir.h>):

                MAXPATH       80   path
                MAXDRIVE  3   drive, including colon
                MAXDIR        66   dir, including leading and
                                   trailing backslashes
                MAXFILE        9   name
                MAXEXT         5   ext, including leading dot

    Each size includes space for the null-terminator.  Each component is
    required, but can be NULL, so the corresponding component is parsed
    but not stored.  fnsplit() assumes enough space to store each non-
    NULL component.

       Returns:     An integer comprising five flags indicating which
                    components of the path name were present in 'path'.
                    The flags (defined in dir.h) and the components they
                    represent are:

                    EXTENSION extension
                    FILENAME  filename
                    DIRECTORY directory (including possible
                                   subdirectories)
                    DRIVE          drive specification
                    WILDCARD  wildcards (? or *)


See Also: fnmerge()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson