BCXSPLITPATH$ function

Purpose:

BCXSPLITPATH$ returns a portion of a full path. The portion to be returned is specified by the Pathflag% parameter.

Syntax:

RetStr = BCXSPLITPATH$(FullPath AS STRING, PathFlag AS INTEGER)

Return Value:

  • Data type: STRING
    RetStr string containing a portion of the path.

Parameters:

  • Data type: STRING
    FullPath Literal or variable string containing path to be split.
  • Data type: INTEGER
    PathFlag One or more flags specifying which portion of the path is to be returned by the function. The flags are
    • FDRV, value 2, returns drive with an appended colon.
    • FPATH, value 4, returns the directory name(s) with backslashes preserved.
    • FNAME, value 8, returns the file name without extension.
    • FEXT, value 16, returns the extension of the file name.
    These flags can be added using the OR operator to return a combined string.

Example:

 DIM FullPath$
 DIM PathFlag%
 DIM RetStr$

 FullPath$ = "C:\directory\FileName.Dot.ext"

 PathFlag% = FDRV
 RetStr$ = BCXSPLITPATH$(FullPath$, PathFlag)
 PRINT RetStr$

 PathFlag% = FPATH
 RetStr$ = BCXSPLITPATH$(FullPath$, PathFlag)
 PRINT RetStr$

 PathFlag% = FNAME
 RetStr$ = BCXSPLITPATH$(FullPath$, PathFlag)
 PRINT RetStr$

 PathFlag% = FEXT
 RetStr$ = BCXSPLITPATH$(FullPath$, PathFlag)
 PRINT RetStr$

 PathFlag% = FDRV OR FPATH OR FNAME
 RetStr$ = BCXSPLITPATH$(FullPath$, PathFlag)
 PRINT RetStr$

Result:

C:
\directory\
FileName.Dot
.ext
C:\directory\FileName.Dot