Sponsored Content
Top Forums Programming scandir() + windows equivalent Post 302215382 by Fronsac on Wednesday 16th of July 2008 07:36:50 AM
Old 07-16-2008
Use FindFirstFile and FindNextFile. They are less powerful than scandir, but I think it might be the best match to what you are trying to achieve,
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Unix Equivalent of Windows NT Diagnostic (Winmsd) report

Hi Guys, Is there a way I can generate a Diagnostic Report for Unix app server/database server (for sun solaris and aix) similar to the system diagnostic report in Windows NT(winmsd). Basically I am looking for the following details below in a single comprehensive report. If there is no... (2 Replies)
Discussion started by: neer
2 Replies

2. Programming

unix equivalent for windows APIs..........................

Hi, Is there any unix equivalents available for the folllowing windows function ? FindFirstFile FindNextFile etc..... Or do i have to write an equivalent api?? Can anybody help me to do the same?? thanks in advance Ani (2 Replies)
Discussion started by: ani
2 Replies

3. Linux

windows startup equivalent in linux

hi all, greetings, please tell me how to start a java GUI program in the startup of the machine. since it invokes a GUI is it possiable to entry the same in /etc/rc2.d/S99userdefinedfiles. thanks in advance ., :-) (1 Reply)
Discussion started by: raguramtgr
1 Replies

4. 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

5. Programming

scandir() for Solaris

I'd like to use scandir() on solaris, but it doesn't find sys/dir.h What do you think I should do? thanks (2 Replies)
Discussion started by: nadiamihu
2 Replies

6. Shell Programming and Scripting

Windows command shell equivalent in Unix

In Windows we use cmd.exe \c as the command SHell What is its equivalent in UNIX ? Thanx for all your help. (10 Replies)
Discussion started by: simonsimon
10 Replies

7. Linux

Unix Equivalent Windows Variable

Hi, I've set my Unix User Profile Variables as follows.. export LANG=en_US.UTF-8 export LC_ALL=en_US.UTF-8 I want to set the same codepages in my Windows Vista Environment.. How can i do that..? Whether the variable names remain same ..? Please help Regards, Vikram... (1 Reply)
Discussion started by: vickramshetty
1 Replies

8. 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

9. Programming

scandir() and threads

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

10. UNIX and Linux Applications

UNIX equivalent of windows terminal server options?

I want to replace Windows terminal server mostly due to cost reasons license cost for 2100 users goes out of roof. The end-user is all windows but I want a jump server that is UNIX based , I have some experience with VNC but I don't want options exists in UNIX to run a terminal services for 2100... (10 Replies)
Discussion started by: lazerz
10 Replies
scandir(3C)						   Standard C Library Functions 					       scandir(3C)

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 alpha- betical 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 TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Stable | +-----------------------------+-----------------------------+ |MT-Level |See below. | +-----------------------------+-----------------------------+ The scandir() function is Unsafe. The alphasort() function is Safe. SEE ALSO
malloc(3C), qsort(3C), readdir(3C), strcoll(3C), attributes(5), lf64(5) SunOS 5.11 4 May 2004 scandir(3C)
All times are GMT -4. The time now is 09:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy