qa.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
GetCurDir
   Example  Back  Contents  Index
──────────────────────────────────────────────────────────────────────────────
 
;* GetCurDir - Gets the current directory of default drive.
;*
;* Shows:   DOS Function - 47h (Get Current Directory)
;*
;* Params:  spec - Pointer to 64-byte buffer to receive directory
;*          path. Path terminates with 0 but does not include
;*          drive and does not begin with backslash.
;*
;* Return:  Short integer with error code
;*          0 if successful
;*          1 if delete error or subdirectory not empty
 
GetCurDir PROC \
        USES ds si, \
        spec:PTR BYTE
 
        LoadPtr ds, si, spec            ; DS:SI = spec address
        mov     ah, 47h                 ; AH = function number
        sub     dl, dl                  ; DL = current drive (0)
        int     21h                     ; Get Current Directory
        mov     ax, 0                   ; Set error code, keep flags
        jnc     exit                    ; Exit if successful
        inc     ax                      ; Else set error code to 1
exit:   ret
 
GetCurDir ENDP
                                    -♦-