function
|
FS_ListDirectory
|
|
Declaration define external function FS_ListDirectory
value stream pathname
into modifiable stream directory
status modifiable stream statusvalue
Purpose
This function retrieves the contents list of the specified directory.
Example:
; fs-listdirectory.xom
include "omfsys.xin"
process
local stream current-dir variable initial-size 1 initial {"C:\omprogs"}
local stream dir-list variable initial-size 0
local stream error-status variable initial-size 1
FS_ListDirectory current-dir into dir-list status error-status
repeat over dir-list
do when file dir-list is directory
output "%_" || "<dir> "
|| dir-list || "%n"
else
output "%_" || "<file>"
|| dir-list || "%n"
done
again
; Output lists all directories "<DIR>" and files "<file>" in current-dir.
Input argument:
- "pathname" is the path name of the directory to be listed.
Output arguments:
- "directory" is a shelf containing the contents of the directory with one directory or file in the list per item. This shelf is cleared before a new directory listing is stored.
- "statusvalue" must have an initial-size of at least 1, and contain either a zero length string if the function succeeds, or one of the following error codes in the current item:
- "EACCES" -- no search permission on the path name
- "ELOOP" -- (UNIX only) a link recursion was detected
- "ENOTDIR" -- the path name is not a valid directory
- "EMFILE" -- the maximum number of file descriptors are currently open
- "ENFILE" -- the system file table is full
- "ENAMETOOLONG" -- the path name exceeds system limits
- "ENOENT" -- the specified path does not exist
- "EAGAIN" -- directory read was blocked
- "EBADF" -- the directory file descriptor is no longer valid
- "EBADMSG" -- (UNIX only) a non-data message was presented
- "EDEADLOCK" -- a possible read deadlock condition was detected
- "EINTR" -- a signal was caught while the function was executing
- "EINVAL" -- attempted to read from a stream linked to a multiplexor
- "EIO" -- a file system I/O error occurred
- "ENOLCK" -- the system record lock table was full
- "ENOLINK" -- (UNIX only) a required link to a remote machine is inactive
- "ENXIO" -- a special file is specified and the file pointer is out of range
Note that "pathname" must reference a valid directory path. Also, "dot" directory entries are not returned.
Generated: August 11, 2000 at 3:07:16 pm
If you have any comments about this section of the documentation, send email to docerrors@omnimark.com
Copyright © OmniMark Technologies Corporation, 1988-2000.