Neo, if I have an old thread that is a few months old, and a few pages back in the forum it was posted in, is it ok to 'bump' it back to the front? or, would you rather i deleted the old thread, and just create a new one? btw the thread has no replies. (2 Replies)
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)
i am tring to sort lots of data thats in many columns by just one column but, if I use sort +16 inputfile the column fluctuates because some of the rows have spaces etc within the text, so the end result is just a mess as it jumps around the columns depending whether it has spaces or not ....ie... (2 Replies)
Hi all!
1)Is there a way to write a program that will work on both solaris and intel based machines.
2)How can I achive this for a program that creates and synchronizes three threads.
Thank you.
vij. (3 Replies)
Hi,
I have a program that has two types of threads:
1) Reader threads
2) Worker Threads
Readers: Their only job is to read files. They just read data from the files and put them into a buffer. They are obviously I/O intensive.
Workers: These are CPU intensive. They do some computation... (5 Replies)
Hi all,
How can I get the list of all Threads and the Total count of threads under a particular process ?
Do suggest !!
Awaiting for the replies !!
Thanks
Varun:b: (2 Replies)
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)
Hello! I started studying studying about POSIX Threads a few days ago... so I am a little confused and I would appreciate some help!
I isolated this code... and I wonder if I could use threads in it!
#include <unistd.h>
#endif
#include <math.h>
//#include "main.h"
#include <sys/time.h>... (1 Reply)
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
LEARN ABOUT OPENSOLARIS
alphasort
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)