CurDir(), Sys(2003), Sys(5)
Where am I? That's the question these three functions answer. CURDIR() and SYS(2003) give you the default directory, while SYS(5) provides the default drive. CURDIR() also can tell you the current directory on other drives.
Usage |
cCurrentDirectory = CURDIR( [ cDriveDesignator ] ) cCurrentDirectory = SYS( 2003 ) |
This isn't really a bug with CURDIR(), but it's worth pointing out here. When you use CD or SET DEFAULT to change drives, it resets the current directory on the drive you were in to the root. So CURDIR("another drive") always returns "\". How useful. |
Usage |
cCurrentDrive = SYS(5) |
Example |
CD F:\VFP\SAMPLES * Where are we? ? CURDIR() && Returns "\VFP\SAMPLES\" ? SYS(2003) && Returns "\VFP\SAMPLES" ? SYS(5) && Returns "F:" CD H:\HACKER ? SYS(5) + CURDIR() && Returns "H:\HACKER\" ? CURDIR("F:") && Should return "\VFP\SAMPLES\", but returns && "\" because changing to H: changed the && default on F: |
See Also |