Function

GLibDiropen

Declaration

GDir*
g_dir_open (
  const gchar* path,
  guint flags,
  GError** error
)

Description

Opens a directory for reading. The names of the files in the directory can then be retrieved using g_dir_read_name(). Note that the ordering is not defined.

Parameters

path

Type: const gchar*

The path to the directory you are interested in. On Unix in the on-disk encoding. On Windows in UTF-8

The data is owned by the caller of the function.
The value is a NUL terminated UTF-8 string.
flags

Type: guint

Currently must be set to 0. Reserved for future use.

error

Type: GError **

The return location for a recoverable error.

The argument can be NULL.
If the return location is not NULL, then you must initialize it to a NULL GError*.
The argument will left initialized to NULL by the function if there are no errors.
In case of error, the argument will be set to a newly allocated GError; the caller will take ownership of the data, and be responsible for freeing it.

Return value

Type: GDir

A newly allocated GDir on success, NULL on failure. If non-NULL, you must free the result with g_dir_close() when you are finished with it.

The caller of the function takes ownership of the data, and is responsible for freeing it.