DECLARE Integer GetSystemDirectory IN Win32API; String @cWinDir, Integer iSize LOCAL lcSysDir, lnSize lnSize = 100 lcSysDir = SPACE(lnSize) lnRetVal = GetSystemDirectory(@lcSysDir, lnSize) IF lnRetVal > 0 ? LEFT(lcSysDir, lnRetVal) RETURN LEFT(lcSysDir, lnRetVal) ELSE ? "System Directory Not Found" RETURN "" ENDIFTo determine the windows directory:
lcpath=WinDir() FUNCTION WinDir() LOCAL lcPath, lnSize lcPath = SPACE(255) lnsize = 255 DECLARE INTEGER GetWindowsDirectory IN Win32API ; STRING @pszSysPath,; INTEGER cchSysPath lnSize = GetWindowsDirectory(@lcPath, lnSize) IF lnSize <= 0 lcPath = "" ELSE lcPath = ADDBS(SUBSTR(lcPath, 1, lnSize)) ENDIF ? lcPath RETURN lcPath ENDFUNCTo check if a file exists:
IF FILE('myfile.txt') ? 'The file exists' ENDIF>Couldn't find a command to