Int 21H [2.0] Function 39H (57) Create directory

Creates a directory using the specified drive and path.

Call with:

AH = 39H

DS:DX = segment:offset of ASCIIZ pathname

Returns:

If function successful

Carry flag = clear

If function unsuccessful

Carry flag = set

AX = error code

Note:

The function fails if:

any element of the pathname does not exist.

a directory with the same name at the end of the same path already exists.

the parent directory for the new directory is the root directory and is full.

[3.0+] the program is running on a network and the user running the program has insufficient access rights.

Example:

Create a directory named MYSUB in the root directory on drive C.

dname db 'C:\MYSUB',0

.

.

.

mov ah,39h ; function number

mov dx,seg dname ; address of pathname

mov ds,dx

mov dx,offset dname

int 21h ; transfer to MS-DOS

jc error ; jump if create failed

.

.

.