Sponsored Content
Full Discussion: scandir() for Solaris
Top Forums Programming scandir() for Solaris Post 302098727 by jim mcnamara on Wednesday 6th of December 2006 09:44:49 AM
Old 12-06-2006
#include <sys/dir.h>

doesn't find anything. But your man page for scandir shows that you are supposed to include it? Is that correct?

Note that most implmentations of this (that I have seen) have you do this
Code:
#include <sys/types.h>
#include <dirent.h>

 

5 More Discussions You Might Find Interesting

1. Programming

Need help with scandir / stat

I'm writing a file manager program using FC3 and C, and I'm having a problem displaying the stat info of subdirectories. #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <dirent.h> int main() { char *dirname = "mydirectory"; struct dirent **namelist; ... (2 Replies)
Discussion started by: Bertsura
2 Replies

2. Programming

scandir() + windows equivalent

Currently, Im trying to redesign some Unix-based C code to work on the Windows operating system and one problem I ran into when compiling was that the compiler failed to recognise scandir() (from my original Linux code) Im aware that scandir() is a Unix-based function, so is there an equivalent... (1 Reply)
Discussion started by: JamesGoh
1 Replies

3. UNIX for Advanced & Expert Users

scandir help

Hi everyone; I am trying to compile and execute a test program I wrote that calls scandir and it seems to not like my prototype. The Documentation on SUN for this function is clear, but I am missed something..... and I can't figure it out; I am using cc -gv -osaveas saveas.c on Sun... (1 Reply)
Discussion started by: dhelie
1 Replies

4. Programming

scandir() and threads

I couldn't find anywhere informations about it. Is scandir() thread-safe? (4 Replies)
Discussion started by: dawwin
4 Replies

5. Solaris

Unable to login using ssh,telnet onto my solaris machine with solaris 10 installed

Hi, I am unable to login into my terminal hosting Solaris 10 and get the below error message "Server refused to allocate pty ld.so.1: sh: fatal: libc.so.1: open failed: No such file or directory " Is there anyways i can get into my machine and what kind of changes are required to be... (7 Replies)
Discussion started by: sankasu
7 Replies
scandir(3)						     Library Functions Manual							scandir(3)

Name
       scandir - scan a directory

Syntax
       #include <sys/types.h>
       #include <sys/dir.h>

       scandir(dirname, namelist, select, compar)
       char *dirname;
       struct direct *(*namelist[]);
       int (*select)();
       int (*compar)();

       alphasort(d1, d2)
       struct direct **d1, **d2;

Description
       The  subroutine	reads the directory dirname and builds an array of pointers to directory entries using It returns the number of entries in
       the array and a pointer to the array through namelist.

       The select parameter is a pointer to a user supplied subroutine which is called by to select which entries are to be included in the array.
       The  select routine is passed a pointer to a directory entry and should return a non-zero value if the directory entry is to be included in
       the array.  If select is null, then all the directory entries will be included.

       The compar parameter is a pointer to a user supplied subroutine which is passed to to sort the completed array.	If this pointer  is  null,
       the array is not sorted.  The is a routine which can be used for the compar parameter to sort the array alphabetically.

       The  memory  allocated  for  the array can be deallocated with free by freeing each pointer in the array and the array itself.  For further
       information, see

Diagnostics
       Returns -1 if the directory cannot be opened for reading or if cannot allocate enough memory to hold all the data structures.

See Also
       directory(3), malloc(3), qsort(3), dir(5)

																	scandir(3)
All times are GMT -4. The time now is 10:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy