03-17-2008
The readdir system call
man page says "This is not the function you are interested in. Look at readdir(3) for the POSIX conforming C library interface. This page documents the bare kernel system call interface, which can change, and which is superseded by getdents(2)."
10 More Discussions You Might Find Interesting
1. Programming
hi all ,
can i save a structure in c in a file? how ?
help me , thx. :) (2 Replies)
Discussion started by: kall_ANSI
2 Replies
2. Programming
hi...do opendir/readdir/closedir work also in windows platform? I tried to access directory name (d_name) but it didn't work out (or perhaps I made a mistake). Could someone share ideas about this?
Thank's in advance. (3 Replies)
Discussion started by: qqq
3 Replies
3. Programming
I receive an integer as argument for a function.
within function definition i want it to be of type struct tm.
eg..
main()
{
int a;
......
}
function(...,..,a,..)
int a;
{
struct tm tm;
if(!a)
^ time(&a);
^ ... (4 Replies)
Discussion started by: bankpro
4 Replies
4. Programming
in my .c file i have a struct atop of the program defined as follows:
#define MAX 10
int curtab;
static struct tab {
int count;
int use;
} tab;
with the initial function following it like so:
int tab_create(int init_count)
{
int i;
for(i=0; i < MAX; i++)
{... (1 Reply)
Discussion started by: micmac700
1 Replies
5. Linux
Hi,
I am working on gcov.Meaning, analysing the functionality of gcov. There is one structure called "struct bb". I am not sure, how struct bb members are getting assigned values. If anyone knows how it is happening pls let me know.
Thanks in advance.
--Vichu (0 Replies)
Discussion started by: Vichu
0 Replies
6. Programming
In C, I want to list all files recursively in a folder. But to do that, how can I distinguish files from directories ? (I realise I could use find in a shell script or use system("ls -R > file") but I want to use only C.)
DIR *ptr;
struct dirent *files;
ptr =... (2 Replies)
Discussion started by: cyler
2 Replies
7. UNIX for Dummies Questions & Answers
Can someone tell me how to do this?
Just a thought that entered my mind when learning about structs.
First thought was:
struct one
{
struct two;
}
struct two
{
three;
}
one->two->three
would this be how you would access "three"? (1 Reply)
Discussion started by: unbelievable21
1 Replies
8. Programming
in C i am using this code to get the c time or a time or m time
struct dirent *dir;
struct stat my;
stat(what, &my);
thetime = my.st_ctime;
How can i check if i have permission to check the c time of the file? (1 Reply)
Discussion started by: omega666
1 Replies
9. UNIX for Dummies Questions & Answers
what is struct winsize used for?
i tried looking it up, but no luck. (0 Replies)
Discussion started by: l flipboi l
0 Replies
10. Programming
Hi,
I have received an application that stores some properties in a file. The existing struct looks like this:
struct TData
{
UINT uSizeIncludingStrings;
// copy of Telnet data struct
UINT uSize;
// basic properties:
TCHAR szHost; //defined in Sshconfig
UINT iPortNr;
TCHAR... (2 Replies)
Discussion started by: Powerponken
2 Replies
LEARN ABOUT REDHAT
getdents
GETDENTS(2) Linux Programmer's Manual GETDENTS(2)
NAME
getdents - get directory entries
SYNOPSIS
#include <unistd.h>
#include <linux/types.h>
#include <linux/dirent.h>
#include <linux/unistd.h>
_syscall3(int, getdents, uint, fd, struct dirent *, dirp, uint, count);
int getdents(unsigned int fd, struct dirent *dirp, unsigned int count);
DESCRIPTION
getdents reads several dirent structures from the directory pointed at by fd into the memory area pointed to by dirp. The parameter count
is the size of the memory area.
The dirent structure is declared as follows:
struct dirent
{
long d_ino; /* inode number */
off_t d_off; /* offset to next dirent */
unsigned short d_reclen; /* length of this dirent */
char d_name [NAME_MAX+1]; /* file name (null-terminated) */
}
d_ino is an inode number. d_off is the distance from the start of the directory to the start of the next dirent. d_reclen is the size of
this entire dirent. d_name is a null-terminated file name.
This call supersedes readdir(2).
RETURN VALUE
On success, the number of bytes read is returned. On end of directory, 0 is returned. On error, -1 is returned, and errno is set appro-
priately.
ERRORS
EBADF Invalid file descriptor fd.
EFAULT Argument points outside the calling process's address space.
EINVAL Result buffer is too small.
ENOENT No such directory.
ENOTDIR
File descriptor does not refer to a directory.
CONFORMING TO
SVr4, SVID. SVr4 documents additional ENOLINK, EIO error conditions.
SEE ALSO
readdir(2), readdir(3)
Linux 1.3.6 1995-07-22 GETDENTS(2)