Contents of the PARSFIL.DOC file
ParseFileSpec: A function for QuickBASIC 4.0, BASCOM 6.0
Copyright 1988, Project X Software Development Group (215) 922 2557
Copyright 1988, InfoSoft
Function: Parse a passed string into drive, path, filename and
Author: Gizmo Mike, 04/18/1988
Returns: The drive, path, filename and extension are returned,
without punctuation marks except for '/'s, into the
respective string variables.Additionally, being a
function, ParseFileSpec returns error conditons if the
reserved string space is insufficient for the full
-1 = not enough room for complete extension
-2 = not enough room for complete filename
-3 = not enough room for complete path name
-4 = not enough room for complete drive
-5 = null string passed
ParseFileSpec will NOT generate string space corrupt
errors should you pass a string too small to hold all
the characters associated with one of the file spec fields.
Rather, it will pass back only part of the information.
This can be avoided by initializing the string variables
to the appropriate lengths:
Drive - 1 space, path/subdir - 64 spaces, filename - 8
spaces, extension - 3 spaces.
DECLARE FUNCTION ParseFileSpec%(Fspec$, Dr$, Path$, Fil$, Ext$)
raw$ = "C:\QB4\QBTOOLS\PROJECTS\filename.ext"
dr$ = " "
path$ = SPACE$(64)
f$ = SPACE$(8)
e$ = SPACE$(3)
errc = ParseFileSpec(raw$, dr$, path$, f$, e$)
PRINT dr$' returns "C"
PRINT path$' returns "\QBTOOLS\PROJECTS\"
PRINT f$' returns "filename"
PRINT e$' returns "ext"
PRINT errc' returns 0
if f$ was initialized to SPACE$(7), then:
f$ will return "filenam" and ParseFileSpec (or errc) will return -2
indicating that there was not enough room for the whole name.
See also: FileNameValid
This routine will be a part of the next QBTOOLS release.