KallistiOS  2.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Data Structures | Functions
dirent.h File Reference

Standard POSIX dirent functionality. More...

#include <unistd.h>
#include <arch/types.h>
#include <kos/fs.h>

Go to the source code of this file.

Data Structures

struct  dirent
 The POSIX dirent which describes a directory entry. More...
struct  DIR
 the DIR structure in KOS More...

Functions

DIRopendir (const char *name)
 Opens a directory based on the specified name.
int closedir (DIR *dir)
 Closes a currently opened directory.
struct direntreaddir (DIR *dir)
 Read the contents of an open directory.
void rewinddir (DIR *dir)
 Not implemented.
int scandir (const char *dir, struct dirent ***namelist, int(*filter)(const struct dirent *), int(*compar)(const struct dirent **, const struct dirent **))
 Not implemented.
void seekdir (DIR *dir, off_t offset)
 Not implemented.
off_t telldir (DIR *dir)
 Not implemented.

Detailed Description

Standard POSIX dirent functionality.

This partially implements the standard POSIX dirent.h functionality.

Author:
Dan Potter

Function Documentation

int closedir ( DIR dir)

Closes a currently opened directory.

Close a DIR that was previously opened with opendir.

Parameters:
dirThe DIR that was returned from an opendir.
Returns:
0 on success, or -1 on error.
DIR* opendir ( const char *  name)

Opens a directory based on the specified name.

The directory specified by name is opened if it exists and returns a directory structure that must be later closed with closedir.

Parameters:
nameThe string name of the dir to open.
Returns:
A directory structure that can be used with readdir
Note:
I believe you can use relative paths with opendir, but it depends on the current working directory (getcwd)
See also:
closedir
readdir
struct dirent* readdir ( DIR dir)
read

Read the contents of an open directory.

Read the contents of an open directory and returns a pointer to the current directory entry. Recurring calls to readdir return the next directory entry.

Note:
Do not free the returned dirent
Parameters:
dirThe directory structure that was returned from an opendir
Returns:
A pointer to the current diretory entry or NULL when there are no more entries.
void rewinddir ( DIR dir)

Not implemented.

int scandir ( const char *  dir,
struct dirent ***  namelist,
int(*)(const struct dirent *)  filter,
int(*)(const struct dirent **, const struct dirent **)  compar 
)

Not implemented.

void seekdir ( DIR dir,
off_t  offset 
)

Not implemented.

off_t telldir ( DIR dir)

Not implemented.