The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

Интерактивная система просмотра системных руководств (man-ов)

 ТемаНаборКатегория 
 
 [Cписок руководств | Печать]

scandir (3)
  • >> scandir (3) ( Solaris man: Библиотечные вызовы )
  • scandir (3) ( FreeBSD man: Библиотечные вызовы )
  • scandir (3) ( Русские man: Библиотечные вызовы )
  • scandir (3) ( Linux man: Библиотечные вызовы )
  •  

    NAME

    scandir, alphasort - scan a directory
     
    

    SYNOPSIS

    #include <sys/types.h>
    #include <dirent.h>
    
    int scandir(const char *dirname, struct dirent *(*namelist[]),
        int (*select)(const struct dirent *),
        int (*dcomp)(const struct dirent  **,
        const struct dirent **));
    

    int alphasort(const struct dirent **d1,
        const struct dirent **d2);
    

     

    DESCRIPTION

    The scandir() function reads the directory dirname using readdir(3C) and builds an array of pointers to directory entries using malloc(3C). The namelist argument is a pointer to an array of structure pointers. The select argument is a pointer to a routine that is called with a pointer to a directory entry and returns a non-zero value if the directory entry is included in the array. If this pointer is NULL, then all the directory entries are included. The dcomp argument is a pointer to a routine that is passed to qsort(3C), which sorts the completed array. If this pointer is NULL, the array is not sorted.

    The alphasort() function can be used as the dcomp() function parameter for the scandir() function to sort the directory entries into alphabetical order, as if by the strcoll(3C) function. Its arguments are the two directory entries to compare.  

    RETURN VALUES

    The scandir() function returns the number of entries in the array and a pointer to the array through the namelist argument. When an error is encountered, scandir() returns -1 and errno is set to indicate the error.

    The alphasort() function returns an integer greater than, equal to, or less than 0 if the directory entry name pointed to by d1 is greater than, equal to, or less than the directory entry name pointed to by d2 when both are interpreted as appropriate to the current locale. There is no return value reserved to indicate an error.  

    ERRORS

    The scandir() function will fail if:

    EOVERFLOW

    The number of directory entries exceeds the number that can be represented by an int.

     

    USAGE

    The scandir() and alphasort() functions have transitional interfaces for 64-bit file offsets. See lf64(5).  

    ATTRIBUTES

    See attributes(5) for descriptions of the following attributes:

    ATTRIBUTE TYPEATTRIBUTE VALUE

    Interface StabilityStable

    MT-Level

    The scandir() function is Unsafe. The alphasort() function is Safe.  

    SEE ALSO

    malloc(3C), qsort(3C), readdir(3C), strcoll(3C), attributes(5), lf64(5)


     

    Index

    NAME
    SYNOPSIS
    DESCRIPTION
    RETURN VALUES
    ERRORS
    USAGE
    ATTRIBUTES
    SEE ALSO


    Поиск по тексту MAN-ов: 




    Партнёры:
    PostgresPro
    Inferno Solutions
    Hosting by Hoster.ru
    Хостинг:

    Закладки на сайте
    Проследить за страницей
    Created 1996-2024 by Maxim Chirkov
    Добавить, Поддержать, Вебмастеру