Home  /  Autodocs  /  dos.library

NAME

CreateDir
Create a new directory

SYNOPSIS

lock = CreateDir( name )
D0 D1

BPTR CreateDir(STRPTR)

FUNCTION

CreateDir() creates a new directory with the specified name. An error is returned if it fails. Directories can only be created on devices which support them, e.g. disks. CreateDir() returns an exclusive Lock on the new directory if it succeeds.

INPUTS

name
pointer to a null-terminated string

RESULT

lock
BCPL pointer to a Lock or NULL for failure. Call IoErr() to find out why the directory creation failed.

NOTES

CreateDir() can be expected to return an exclusive Lock to the directory just created. You may want to either change the Lock type to SHARED_LOCk via ChangeMode() or, alternatively, UnLock() it and then use Lock(name, SHARED_LOCK) to obtain a shared Lock. Exclusive locks cannot be used with functions such as DupLock() or NameFromLock(), which is why you may want to avoid them.

SEE ALSO

Lock(), UnLock(), ChangeMode(), IoErr()