[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
+---------------------------------+
| SYS(2014, <expC1> [, <expC2>]) |
+---------------------------------+
-----------------------------------
Returns minimum path between file and current directory, or minimum path
between file and specified directory.
Return value - Character
-----------------------------------
<expC1>
Name of file. Returns minimum path between file and current directory.
<expC2>
Directory specification. Returns relative minimum path between file
and specified directory.
SYS(2014), when used with the FULLPATH() function, can be used to make
applications portable. That is, given the location of the current
program and the location of other files used by the program, the
FULLPATH() and SYS(2014) functions are used to obtain the proper paths
of these files. Once the files' paths are determined, the files can be
accessed by the program.
To return the minimum path between a file and the current directory,
include the name of the file in the character expression <expC1>. The
current directory may be changed with the SET DEFAULT command.
You may also return the relative minimum path between a file and a
specified directory by including the file name in <expC1> and the
directory specification in <expC2>.
See the FULLPATH() function in this help facility for additional
information and an example of the use of SYS(2014) and FULLPATH().
+---------------------------------+
| Example |
+---------------------------------+
In this example we'll examine how to use FULLPATH() and SYS(2014) to
locate a database used in the creation of a screen.
When you create a screen with the FoxPro screen builder, information
about the screen you create is stored in a screen database (which we'll
call SCREEN.SCX). Fields in another database (which we'll call
DATA.DBF) may be used in the screen you create. The location of the
DATA database is stored in the SCREEN database when you save the screen.
The following directory structure is used for this example. The SCREEN
database is located in the SC directory off the root of the C: drive
(C:\SC\SCREEN.SCX). The DATA database is located in the DB directory
off the SC directory. The "home" directory for this example is the FP
directory off the DB directory.
C:
|--SC .-------- SCREEN.SCX
| |---DB .---- DATA.DBF
| | +--FP .- Home directory
| +--TX
+--WK
The SCREEN database stores the location of the DATA database relative to
the SCREEN database -- DB\DATA.DBF.
A program could generate a USE command to open the DATA database. It
must locate DATA from the path information stored in the SCREEN
database. The program could use FULLPATH():
FULLPATH('DB\DATA.DBF', 'C:\SC\SCREEN.SCX')
which returns 'C:\SC\DB\DATA.DBF'. This is then used in SYS(2014) with
the home directory:
SYS(2014, 'C:\SC\DB\DATA.DBF', 'C:\SC\DB\FP')
which returns '\SC\DB\DATA.DBF'. The command
USE LOCFILE('\SC\DB\DATA.DBF', 'DBF', 'Where is ... ')
then opens the DATA.DBF database. If the database has been moved from
the location stored in the SCREEN database, the open file dialog is
displayed to locate the file.
The following list shows what SYS(2014) returns for different home
directories when given 'C:\SC\DB\DATA.DBF':
The following list shows what SYS(2014) returns for different home
directories when given 'C:\A\B\DATA.DBF':
Home SYS(2014) returns:
---- ------------------
C:\ SC\DB\DATA.DBF
C:\WK\ \SC\DB\DATA.DBF
C:\SC\TX\ \SC\DB\DATA.DBF
C:\SC\DB\FP \SC\DB\DATA.DBF
C:\SC\DB\ DATA.DBF
C:\SC\ DB\DATA.DBF
-----------------------------------
See Also: FULLPATH(), SET DEFAULT, SET PATH, SYS()
-----------------------------------
See Also:
FULLPATH()
SET DEFAULT
SET PATH
SYS()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson