Function 39h Create Directory

mov dx, seg Dir

mov ds, dx

mov dx, offset Dir ;ds:dx points to name of new directory

mov ah, 39h ;Create Directory

int 21h

jc error_handler ;carry set means error

Create Directory (Function 39h) creates a new directory by using the specified path.

Parameter

Dir

Points to a zero-terminated ASCII string that specifies the directory to create. This string must be a valid MS-DOS directory name and cannot contain wildcards.

Return Value

If the function is successful, the carry flag is clear. Otherwise, the carry flag is set and the AX register contains an error value, which may be one of the following values:

Value Name

0002h ERROR_FILE_NOT_FOUND
0003h ERROR_PATH_NOT_FOUND
0005h ERROR_ACCESS_DENIED

Comment

This function returns 0005h (ERROR_ACCESS_DENIED) if a file or directory with the specified name already exists in the specified path.

See Also

Function 3Ah Remove Directory
Function 3Bh Change Current Directory
Function 47h Get Current Directory