fts_open()

open a file hierarchy 

Function


SYNOPSIS

#include <fts.h>

FTS *fts_open(char const **argv, int options, int(*compar)(const FTSENT **, const FTSENT **));


DESCRIPTION

The fts_open() function is used to open a file hierarchy for traversal.


PARAMETERS

argv 

Is a NULL terminated array of character pointers naming one or more paths that make up the file hierarchy.

options 

Must be a set of the following file processing options:

FTS_COMFOLLOW 

Windows has no symbolic links, so this option is ignored.

FTS_LOGICAL 

This sets FTS_NOCHDIR.

FTS_NOCHDIR 

This causes the fts functions not change directories as they traverse the file hierarchy. Applications should not change their current directory and try to access files unless FTS_NOCHDIR is set.

FTS_NOSTAT 

This allows the fts functions to set the fts_info field to FTS_NSOK and leave the contents of the statp field undefined. This is used for a performance optimization.

FTS_PHYSICAL 

This causes fts functions to return pointers to the files themselves. Either FTS_PHYSICAL or FTS_LOGICAL must be provided.

FTS_SEEDOT 

This causes fts functions to return FTSENT structures for any files named '\&.' or '..'.

FTS_XDEV 

This causes fts functions not to traverse into directories that have a device number different from which the traversal began.

compar 

Specifies user defined function that is used to order the traversal of the file hierarchy. This function takes pointers to two FTSENT structures as arguments and return a negative number, zero, or a positive number. A negative value indicates that the file referenced in the first argument comes before the second, in any order if the value is zero, and after the second argument if the value is positive. If the compar argument is NULL, then the directory is traversed in the order of the list in argv for root paths and the order listed in the directory for everything else.


RETURN VALUES

The fts_open() function returns a handle to a file hierarchy, if successful. The fts_open() function may fail and set errno for any of the errors that the open() and malloc() functions specify.

EINVAL 

The option list was invalid.

ENOENT 

The path specified in argv was zero length.


CONFORMANCE

4.4BSD


MULTITHREAD SAFETY LEVEL

Unsafe.


PORTING ISSUES

FTS_COMFOLLOW is ignored because there are no symbolic links on Windows.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
chdir(), fts_children(), fts_close(), fts_read(), fts_set(), qsort(), stat()


PTC MKS Toolkit 10.3 Documentation Build 39.