OpenDirectoryItem

Opens a directory specified by an item.

Directory *OpenDirectoryItem( Item openFileItem )

This function opens a directory. It allocates a new directory structure, opens the directory, and prepares for a traversal of the contents of the directory. Unlike OpenDirectoryPath(), you specify the file for the directory by its item number rather than by its pathname.

openFileItem
The item number of the open file to use for the directory. When you later call CloseDirectory(), this file item will automatically be deleted for you, you do not need to call CloseDiskFile().
The function returns a pointer to the directory structure that is created or NULL if an error occurs.

Folio call implemented in file folio V20.

When you are done scanning the directory and call CloseDirectory(), the item you gave to OpenDirectoryItem() will automatically be closed for you. In essence, when you call OpenDirectoryItem(), you are giving away the File item to the file folio, which will dispose of it when the directory is closed.

directoryfunctions.h, filesystem.lib

OpenDiskFile(), OpenDiskFileInDir(), OpenDirectoryPath(), CloseDirectory()