Dec 222017
Parse command line into filename in QBasic.
File PARSFIL.ZIP from The Programmer’s Corner in
Category BASIC Language
Parse command line into filename in QBasic.
File Name File Size Zip Size Zip Type
PARSFIL.DOC 2008 922 deflated
PARSFIL.OBJ 468 370 deflated
PARST.BAS 469 237 deflated
TPCREAD.ME 199 165 deflated

Download File PARSFIL.ZIP Here

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.

 December 22, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>