KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /proc/21585/root/usr/share/gtk-doc/html/glib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/21585/root/usr/share/gtk-doc/html/glib/glib-File-Utilities.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>File Utilities</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
<link rel="start" href="index.html" title="GLib Reference Manual">
<link rel="up" href="glib-utilities.html" title="GLib Utilities">
<link rel="prev" href="glib-Spawning-Processes.html" title="Spawning Processes">
<link rel="next" href="glib-Shell-related-Utilities.html" title="Shell-related Utilities">
<meta name="generator" content="GTK-Doc V1.6 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="glib.html" title="GLib Overview">
<link rel="chapter" href="glib-fundamentals.html" title="GLib Fundamentals">
<link rel="chapter" href="glib-core.html" title="GLib Core Application Support">
<link rel="chapter" href="glib-utilities.html" title="GLib Utilities">
<link rel="chapter" href="glib-data-types.html" title="GLib Data Types">
<link rel="chapter" href="tools.html" title="GLib Tools">
<link rel="index" href="ix01.html" title="Index">
<link rel="index" href="ix02.html" title="Index of deprecated symbols">
<link rel="index" href="ix03.html" title="Index of new symbols in 2.2">
<link rel="index" href="ix04.html" title="Index of new symbols in 2.4">
<link rel="index" href="ix05.html" title="Index of new symbols in 2.6">
<link rel="index" href="ix06.html" title="Index of new symbols in 2.8">
<link rel="index" href="ix07.html" title="Index of new symbols in 2.10">
<link rel="index" href="ix08.html" title="Index of new symbols in 2.12">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="glib-Spawning-Processes.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="glib-utilities.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GLib Reference Manual</th>
<td><a accesskey="n" href="glib-Shell-related-Utilities.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id3111134" class="shortcut">Top</a>
                  &#160;|&#160;
                  <a href="#id2796503" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="glib-File-Utilities"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id3111134"></a><span class="refentrytitle">File Utilities</span>
</h2>
<p>File Utilities &#8212; various file-related functions.</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">

#include &lt;glib.h&gt;
#include &lt;glib/gstdio.h&gt;


enum        <a href="glib-File-Utilities.html#GFileError">GFileError</a>;
#define     <a href="glib-File-Utilities.html#G-FILE-ERROR:CAPS">G_FILE_ERROR</a>
enum        <a href="glib-File-Utilities.html#GFileTest">GFileTest</a>;
<a href="glib-File-Utilities.html#GFileError">GFileError</a>  <a href="glib-File-Utilities.html#g-file-error-from-errno">g_file_error_from_errno</a>         (<a href="glib-Basic-Types.html#gint">gint</a> err_no);
<a href="glib-Basic-Types.html#gboolean">gboolean</a>    <a href="glib-File-Utilities.html#g-file-get-contents">g_file_get_contents</a>             (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename,
                                             <a href="glib-Basic-Types.html#gchar">gchar</a> **contents,
                                             <a href="glib-Basic-Types.html#gsize">gsize</a> *length,
                                             <a href="glib-Error-Reporting.html#GError">GError</a> **error);
<a href="glib-Basic-Types.html#gboolean">gboolean</a>    <a href="glib-File-Utilities.html#g-file-set-contents">g_file_set_contents</a>             (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename,
                                             const <a href="glib-Basic-Types.html#gchar">gchar</a> *contents,
                                             <a href="glib-Basic-Types.html#gssize">gssize</a> length,
                                             <a href="glib-Error-Reporting.html#GError">GError</a> **error);
<a href="glib-Basic-Types.html#gboolean">gboolean</a>    <a href="glib-File-Utilities.html#g-file-test">g_file_test</a>                     (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename,
                                             <a href="glib-File-Utilities.html#GFileTest">GFileTest</a> test);
<a href="glib-Basic-Types.html#gint">gint</a>        <a href="glib-File-Utilities.html#g-mkstemp">g_mkstemp</a>                       (<a href="glib-Basic-Types.html#gchar">gchar</a> *tmpl);
<a href="glib-Basic-Types.html#gint">gint</a>        <a href="glib-File-Utilities.html#g-file-open-tmp">g_file_open_tmp</a>                 (const <a href="glib-Basic-Types.html#gchar">gchar</a> *tmpl,
                                             <a href="glib-Basic-Types.html#gchar">gchar</a> **name_used,
                                             <a href="glib-Error-Reporting.html#GError">GError</a> **error);
<a href="glib-Basic-Types.html#gchar">gchar</a>*      <a href="glib-File-Utilities.html#g-file-read-link">g_file_read_link</a>                (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename,
                                             <a href="glib-Error-Reporting.html#GError">GError</a> **error);
int         <a href="glib-File-Utilities.html#g-mkdir-with-parents">g_mkdir_with_parents</a>            (const <a href="glib-Basic-Types.html#gchar">gchar</a> *pathname,
                                             int mode);

            <a href="glib-File-Utilities.html#GDir">GDir</a>;
<a href="glib-File-Utilities.html#GDir">GDir</a>*       <a href="glib-File-Utilities.html#g-dir-open">g_dir_open</a>                      (const <a href="glib-Basic-Types.html#gchar">gchar</a> *path,
                                             <a href="glib-Basic-Types.html#guint">guint</a> flags,
                                             <a href="glib-Error-Reporting.html#GError">GError</a> **error);
const <a href="glib-Basic-Types.html#gchar">gchar</a>* <a href="glib-File-Utilities.html#g-dir-read-name">g_dir_read_name</a>                (<a href="glib-File-Utilities.html#GDir">GDir</a> *dir);
void        <a href="glib-File-Utilities.html#g-dir-rewind">g_dir_rewind</a>                    (<a href="glib-File-Utilities.html#GDir">GDir</a> *dir);
void        <a href="glib-File-Utilities.html#g-dir-close">g_dir_close</a>                     (<a href="glib-File-Utilities.html#GDir">GDir</a> *dir);

            <a href="glib-File-Utilities.html#GMappedFile">GMappedFile</a>;
<a href="glib-File-Utilities.html#GMappedFile">GMappedFile</a>* <a href="glib-File-Utilities.html#g-mapped-file-new">g_mapped_file_new</a>              (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename,
                                             <a href="glib-Basic-Types.html#gboolean">gboolean</a> writable,
                                             <a href="glib-Error-Reporting.html#GError">GError</a> **error);
void        <a href="glib-File-Utilities.html#g-mapped-file-free">g_mapped_file_free</a>              (<a href="glib-File-Utilities.html#GMappedFile">GMappedFile</a> *file);
<a href="glib-Basic-Types.html#gsize">gsize</a>       <a href="glib-File-Utilities.html#g-mapped-file-get-length">g_mapped_file_get_length</a>        (<a href="glib-File-Utilities.html#GMappedFile">GMappedFile</a> *file);
<a href="glib-Basic-Types.html#gchar">gchar</a>*      <a href="glib-File-Utilities.html#g-mapped-file-get-contents">g_mapped_file_get_contents</a>      (<a href="glib-File-Utilities.html#GMappedFile">GMappedFile</a> *file);

int         <a href="glib-File-Utilities.html#g-open">g_open</a>                          (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename,
                                             int flags,
                                             int mode);
int         <a href="glib-File-Utilities.html#g-rename">g_rename</a>                        (const <a href="glib-Basic-Types.html#gchar">gchar</a> *oldfilename,
                                             const <a href="glib-Basic-Types.html#gchar">gchar</a> *newfilename);
int         <a href="glib-File-Utilities.html#g-mkdir">g_mkdir</a>                         (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename,
                                             int mode);
int         <a href="glib-File-Utilities.html#g-stat">g_stat</a>                          (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename,
                                             struct stat *buf);
int         <a href="glib-File-Utilities.html#g-lstat">g_lstat</a>                         (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename,
                                             struct stat *buf);
int         <a href="glib-File-Utilities.html#g-unlink">g_unlink</a>                        (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename);
int         <a href="glib-File-Utilities.html#g-remove">g_remove</a>                        (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename);
int         <a href="glib-File-Utilities.html#g-rmdir">g_rmdir</a>                         (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename);
FILE*       <a href="glib-File-Utilities.html#g-fopen">g_fopen</a>                         (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename,
                                             const <a href="glib-Basic-Types.html#gchar">gchar</a> *mode);
FILE*       <a href="glib-File-Utilities.html#g-freopen">g_freopen</a>                       (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename,
                                             const <a href="glib-Basic-Types.html#gchar">gchar</a> *mode,
                                             FILE *stream);
int         <a href="glib-File-Utilities.html#g-chmod">g_chmod</a>                         (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename,
                                             int mode);
int         <a href="glib-File-Utilities.html#g-access">g_access</a>                        (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename,
                                             int mode);
int         <a href="glib-File-Utilities.html#g-creat">g_creat</a>                         (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename,
                                             int mode);
int         <a href="glib-File-Utilities.html#g-chdir">g_chdir</a>                         (const <a href="glib-Basic-Types.html#gchar">gchar</a> *path);

</pre>
</div>
<div class="refsect1" lang="en">
<a name="id2796503"></a><h2>Description</h2>
<p>
There is a group of functions which wrap the common POSIX functions 
dealing with filenames (<a href="glib-File-Utilities.html#g-open"><code class="function">g_open()</code></a>, <a href="glib-File-Utilities.html#g-rename"><code class="function">g_rename()</code></a>, <a href="glib-File-Utilities.html#g-mkdir"><code class="function">g_mkdir()</code></a>, <a href="glib-File-Utilities.html#g-stat"><code class="function">g_stat()</code></a>, 
<a href="glib-File-Utilities.html#g-unlink"><code class="function">g_unlink()</code></a>, <a href="glib-File-Utilities.html#g-remove"><code class="function">g_remove()</code></a>, <a href="glib-File-Utilities.html#g-fopen"><code class="function">g_fopen()</code></a>, <a href="glib-File-Utilities.html#g-freopen"><code class="function">g_freopen()</code></a>). The point of these 
wrappers is to make it possible to handle file names with any Unicode 
characters in them on Windows without having to use ifdefs and the 
wide character API in the application code.
</p>
<p>
The pathname argument should be in the GLib file name encoding. On
POSIX this is the actual on-disk encoding which might correspond to
the locale settings of the process (or the 
<code class="envar">G_FILENAME_ENCODING</code> environment variable), or not.
</p>
<p>
On Windows the GLib file name encoding is UTF-8. Note that the
Microsoft C library does not use UTF-8, but has separate APIs for
current system code page and wide characters (UTF-16). The GLib
wrappers call the wide character API if present (on modern Windows
systems), otherwise convert to/from the system code page.
</p>
<p>
Another group of functions allows to open and read directories
in the GLib file name encoding. These are <a href="glib-File-Utilities.html#g-dir-open"><code class="function">g_dir_open()</code></a>, 
<a href="glib-File-Utilities.html#g-dir-read-name"><code class="function">g_dir_read_name()</code></a>, <a href="glib-File-Utilities.html#g-dir-rewind"><code class="function">g_dir_rewind()</code></a>, <a href="glib-File-Utilities.html#g-dir-close"><code class="function">g_dir_close()</code></a>.
</p>
</div>
<div class="refsect1" lang="en">
<a name="id3112941"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id3112951"></a><h3>
<a name="GFileError"></a>enum GFileError</h3>
<a class="indexterm" name="id3112963"></a><pre class="programlisting">typedef enum
{
  G_FILE_ERROR_EXIST,
  G_FILE_ERROR_ISDIR,
  G_FILE_ERROR_ACCES,
  G_FILE_ERROR_NAMETOOLONG,
  G_FILE_ERROR_NOENT,
  G_FILE_ERROR_NOTDIR,
  G_FILE_ERROR_NXIO,
  G_FILE_ERROR_NODEV,
  G_FILE_ERROR_ROFS,
  G_FILE_ERROR_TXTBSY,
  G_FILE_ERROR_FAULT,
  G_FILE_ERROR_LOOP,
  G_FILE_ERROR_NOSPC,
  G_FILE_ERROR_NOMEM,
  G_FILE_ERROR_MFILE,
  G_FILE_ERROR_NFILE,
  G_FILE_ERROR_BADF,
  G_FILE_ERROR_INVAL,
  G_FILE_ERROR_PIPE,
  G_FILE_ERROR_AGAIN,
  G_FILE_ERROR_INTR,
  G_FILE_ERROR_IO,
  G_FILE_ERROR_PERM,
  G_FILE_ERROR_NOSYS,
  G_FILE_ERROR_FAILED
} GFileError;
</pre>
<p>
Values corresponding to <code class="literal">errno</code> codes returned from file operations
on UNIX. Unlike <code class="literal">errno</code> codes, <a href="glib-File-Utilities.html#GFileError"><span class="type">GFileError</span></a> values are available on 
all systems, even Windows. The exact meaning of each code depends on what
sort of file operation you were performing; the UNIX documentation
gives more details. The following error code descriptions come 
from the GNU C Library manual, and are under the copyright
of that manual.
</p>
<p>
It's not very portable to make detailed assumptions about exactly
which errors will be returned from a given operation. Some errors
don't occur on some systems, etc., sometimes there are subtle
differences in when a system will report a given error, etc.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><a name="G-FILE-ERROR-EXIST:CAPS"></a><code class="literal">G_FILE_ERROR_EXIST</code></span></td>
<td>Operation not permitted; only the owner of the
     file (or other resource) or processes with special privileges can
     perform the operation.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="G-FILE-ERROR-ISDIR:CAPS"></a><code class="literal">G_FILE_ERROR_ISDIR</code></span></td>
<td>File is a directory; you cannot open a directory
     for writing, or create or remove hard links to it.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="G-FILE-ERROR-ACCES:CAPS"></a><code class="literal">G_FILE_ERROR_ACCES</code></span></td>
<td>Permission denied; the file permissions do not
     allow the attempted operation.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="G-FILE-ERROR-NAMETOOLONG:CAPS"></a><code class="literal">G_FILE_ERROR_NAMETOOLONG</code></span></td>
<td>Filename too long.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="G-FILE-ERROR-NOENT:CAPS"></a><code class="literal">G_FILE_ERROR_NOENT</code></span></td>
<td>No such file or directory.  This is a "file
     doesn't exist" error for ordinary files that are referenced in
     contexts where they are expected to already exist.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="G-FILE-ERROR-NOTDIR:CAPS"></a><code class="literal">G_FILE_ERROR_NOTDIR</code></span></td>
<td>A file that isn't a directory was specified when
     a directory is required.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="G-FILE-ERROR-NXIO:CAPS"></a><code class="literal">G_FILE_ERROR_NXIO</code></span></td>
<td>No such device or address.  The system tried to
     use the device represented by a file you specified, and it
     couldn't find the device.  This can mean that the device file was
     installed incorrectly, or that the physical device is missing or
     not correctly attached to the computer.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="G-FILE-ERROR-NODEV:CAPS"></a><code class="literal">G_FILE_ERROR_NODEV</code></span></td>
<td>This file is of a type that doesn't support
     mapping.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="G-FILE-ERROR-ROFS:CAPS"></a><code class="literal">G_FILE_ERROR_ROFS</code></span></td>
<td>The directory containing the new link can't be
          modified because it's on a read-only file system.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="G-FILE-ERROR-TXTBSY:CAPS"></a><code class="literal">G_FILE_ERROR_TXTBSY</code></span></td>
<td>Text file busy.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="G-FILE-ERROR-FAULT:CAPS"></a><code class="literal">G_FILE_ERROR_FAULT</code></span></td>
<td>You passed in a pointer to bad memory.
  (GLib won't reliably return this, don't pass in pointers to bad
  memory.)
</td>
</tr>
<tr>
<td>
<span class="term"><a name="G-FILE-ERROR-LOOP:CAPS"></a><code class="literal">G_FILE_ERROR_LOOP</code></span></td>
<td>Too many levels of symbolic links were encountered
  in looking up a file name.  This often indicates a cycle of symbolic
  links.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="G-FILE-ERROR-NOSPC:CAPS"></a><code class="literal">G_FILE_ERROR_NOSPC</code></span></td>
<td>No space left on device; write operation on a
  file failed because the disk is full.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="G-FILE-ERROR-NOMEM:CAPS"></a><code class="literal">G_FILE_ERROR_NOMEM</code></span></td>
<td>No memory available.  The system cannot allocate
     more virtual memory because its capacity is full.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="G-FILE-ERROR-MFILE:CAPS"></a><code class="literal">G_FILE_ERROR_MFILE</code></span></td>
<td>The current process has too many files open and
     can't open any more.  Duplicate descriptors do count toward this
     limit.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="G-FILE-ERROR-NFILE:CAPS"></a><code class="literal">G_FILE_ERROR_NFILE</code></span></td>
<td>There are too many distinct file openings in the
     entire system.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="G-FILE-ERROR-BADF:CAPS"></a><code class="literal">G_FILE_ERROR_BADF</code></span></td>
<td>Bad file descriptor; for example, I/O on a
     descriptor that has been closed or reading from a descriptor open
     only for writing (or vice versa).
</td>
</tr>
<tr>
<td>
<span class="term"><a name="G-FILE-ERROR-INVAL:CAPS"></a><code class="literal">G_FILE_ERROR_INVAL</code></span></td>
<td>Invalid argument.  This is used to indicate
     various kinds of problems with passing the wrong argument to a
     library function.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="G-FILE-ERROR-PIPE:CAPS"></a><code class="literal">G_FILE_ERROR_PIPE</code></span></td>
<td>Broken pipe; there is no process reading from the
     other end of a pipe.  Every library function that returns this
     error code also generates a `SIGPIPE' signal; this signal
     terminates the program if not handled or blocked.  Thus, your
     program will never actually see this code unless it has handled or
     blocked `SIGPIPE'.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="G-FILE-ERROR-AGAIN:CAPS"></a><code class="literal">G_FILE_ERROR_AGAIN</code></span></td>
<td>Resource temporarily unavailable; the call might
     work if you try again later.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="G-FILE-ERROR-INTR:CAPS"></a><code class="literal">G_FILE_ERROR_INTR</code></span></td>
<td>Interrupted function call; an asynchronous signal
     occurred and prevented completion of the call.  When this
     happens, you should try the call again.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="G-FILE-ERROR-IO:CAPS"></a><code class="literal">G_FILE_ERROR_IO</code></span></td>
<td>Input/output error; usually used for physical read
    or write errors. i.e. the disk or other physical device hardware
    is returning errors.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="G-FILE-ERROR-PERM:CAPS"></a><code class="literal">G_FILE_ERROR_PERM</code></span></td>
<td>Operation not permitted; only the owner of the
     file (or other resource) or processes with special privileges can
     perform the operation.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="G-FILE-ERROR-NOSYS:CAPS"></a><code class="literal">G_FILE_ERROR_NOSYS</code></span></td>
<td>Function not implemented; this indicates that the
    system is missing some functionality.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="G-FILE-ERROR-FAILED:CAPS"></a><code class="literal">G_FILE_ERROR_FAILED</code></span></td>
<td>Does not correspond to a UNIX error code; this
  is the standard "failed for unspecified reason" error code present in 
  all <a href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a> error code enumerations. Returned if no specific
  code applies.

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3113555"></a><h3>
<a name="G-FILE-ERROR:CAPS"></a>G_FILE_ERROR</h3>
<a class="indexterm" name="id3113566"></a><pre class="programlisting">#define G_FILE_ERROR g_file_error_quark ()
</pre>
<p>
Error domain for file operations. Errors in this domain will
be from the <a href="glib-File-Utilities.html#GFileError"><span class="type">GFileError</span></a> enumeration. See <a href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for information on 
error domains.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3113595"></a><h3>
<a name="GFileTest"></a>enum GFileTest</h3>
<a class="indexterm" name="id3113605"></a><pre class="programlisting">typedef enum
{
  G_FILE_TEST_IS_REGULAR    = 1 &lt;&lt; 0,
  G_FILE_TEST_IS_SYMLINK    = 1 &lt;&lt; 1,
  G_FILE_TEST_IS_DIR        = 1 &lt;&lt; 2,
  G_FILE_TEST_IS_EXECUTABLE = 1 &lt;&lt; 3,
  G_FILE_TEST_EXISTS        = 1 &lt;&lt; 4
} GFileTest;
</pre>
<p>
A test to perform on a file using <a href="glib-File-Utilities.html#g-file-test"><code class="function">g_file_test()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><a name="G-FILE-TEST-IS-REGULAR:CAPS"></a><code class="literal">G_FILE_TEST_IS_REGULAR</code></span></td>
<td>
<a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the file is a regular file (not a symlink or directory)
</td>
</tr>
<tr>
<td>
<span class="term"><a name="G-FILE-TEST-IS-SYMLINK:CAPS"></a><code class="literal">G_FILE_TEST_IS_SYMLINK</code></span></td>
<td>
<a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the file is a symlink.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="G-FILE-TEST-IS-DIR:CAPS"></a><code class="literal">G_FILE_TEST_IS_DIR</code></span></td>
<td>
<a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the file is a directory.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="G-FILE-TEST-IS-EXECUTABLE:CAPS"></a><code class="literal">G_FILE_TEST_IS_EXECUTABLE</code></span></td>
<td>
<a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the file is executable.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="G-FILE-TEST-EXISTS:CAPS"></a><code class="literal">G_FILE_TEST_EXISTS</code></span></td>
<td>
<a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the file exists. It may or may not be a regular file.

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3113771"></a><h3>
<a name="g-file-error-from-errno"></a>g_file_error_from_errno ()</h3>
<a class="indexterm" name="id3113781"></a><pre class="programlisting"><a href="glib-File-Utilities.html#GFileError">GFileError</a>  g_file_error_from_errno         (<a href="glib-Basic-Types.html#gint">gint</a> err_no);</pre>
<p>
Gets a <a href="glib-File-Utilities.html#GFileError"><span class="type">GFileError</span></a> constant based on the passed-in <em class="parameter"><code>errno</code></em>.
For example, if you pass in <code class="literal">EEXIST</code> this function returns
<a href="glib-File-Utilities.html#G-FILE-ERROR-EXIST:CAPS"><span class="type">G_FILE_ERROR_EXIST</span></a>. Unlike <em class="parameter"><code>errno</code></em> values, you can portably
assume that all <a href="glib-File-Utilities.html#GFileError"><span class="type">GFileError</span></a> values will exist.
</p>
<p>
Normally a <a href="glib-File-Utilities.html#GFileError"><span class="type">GFileError</span></a> value goes into a <a href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a> returned
from a function that manipulates files. So you would use
<a href="glib-File-Utilities.html#g-file-error-from-errno"><code class="function">g_file_error_from_errno()</code></a> when constructing a <a href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>err_no</code></em>&#160;:</span></td>
<td> an "errno" value
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> <a href="glib-File-Utilities.html#GFileError"><span class="type">GFileError</span></a> corresponding to the given <em class="parameter"><code>errno</code></em>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3113918"></a><h3>
<a name="g-file-get-contents"></a>g_file_get_contents ()</h3>
<a class="indexterm" name="id3113928"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboolean</a>    g_file_get_contents             (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename,
                                             <a href="glib-Basic-Types.html#gchar">gchar</a> **contents,
                                             <a href="glib-Basic-Types.html#gsize">gsize</a> *length,
                                             <a href="glib-Error-Reporting.html#GError">GError</a> **error);</pre>
<p>
Reads an entire file into allocated memory, with good error
checking. 
</p>
<p>
If the call was successful, it returns <a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> and sets <em class="parameter"><code>contents</code></em> to the file 
contents and <em class="parameter"><code>length</code></em> to the length of the file contents in bytes. The string 
stored in <em class="parameter"><code>contents</code></em> will be nul-terminated, so for text files you can pass 
<a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> for the <em class="parameter"><code>length</code></em> argument. If the call was not successful, it returns 
<a href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> and sets <em class="parameter"><code>error</code></em>. The error domain is <a href="glib-File-Utilities.html#G-FILE-ERROR:CAPS"><span class="type">G_FILE_ERROR</span></a>. Possible error  
codes are those in the <a href="glib-File-Utilities.html#GFileError"><span class="type">GFileError</span></a> enumeration. In the error case, 
<em class="parameter"><code>contents</code></em> is set to <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> and <em class="parameter"><code>length</code></em> is set to zero.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></td>
<td> name of a file to read contents from, in the GLib file name encoding
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>contents</code></em>&#160;:</span></td>
<td> location to store an allocated string
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>length</code></em>&#160;:</span></td>
<td> location to store length in bytes of the contents, or <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></td>
<td> return location for a <a href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> <a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> on success, <a href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if an error occurred
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3114173"></a><h3>
<a name="g-file-set-contents"></a>g_file_set_contents ()</h3>
<a class="indexterm" name="id3114185"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboolean</a>    g_file_set_contents             (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename,
                                             const <a href="glib-Basic-Types.html#gchar">gchar</a> *contents,
                                             <a href="glib-Basic-Types.html#gssize">gssize</a> length,
                                             <a href="glib-Error-Reporting.html#GError">GError</a> **error);</pre>
<p>
Writes all of <em class="parameter"><code>contents</code></em> to a file named <em class="parameter"><code>filename</code></em>, with good error checking.
If a file called <em class="parameter"><code>filename</code></em> already exists it will be overwritten.
</p>
<p>
This write is atomic in the sense that it is first written to a temporary
file which is then renamed to the final name. Notes:
</p>
<div class="itemizedlist"><ul type="disc">
<li>
   On Unix, if <em class="parameter"><code>filename</code></em> already exists hard links to <em class="parameter"><code>filename</code></em> will break.
   Also since the file is recreated, existing permissions, access control
   lists, metadata etc. may be lost. If <em class="parameter"><code>filename</code></em> is a symbolic link,
   the link itself will be replaced, not the linked file.
</li>
<li>
  On Windows renaming a file will not remove an existing file with the
  new name, so on Windows there is a race condition between the existing
  file being removed and the temporary file being renamed.
</li>
<li>
  On Windows there is no way to remove a file that is open to some
  process, or mapped into memory. Thus, this function will fail if
  <em class="parameter"><code>filename</code></em> already exists and is open.
</li>
</ul></div>
<p>
</p>
<p>
If the call was sucessful, it returns <a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>. If the call was not successful,
it returns <a href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> and sets <em class="parameter"><code>error</code></em>. The error domain is <a href="glib-File-Utilities.html#G-FILE-ERROR:CAPS"><span class="type">G_FILE_ERROR</span></a>.
Possible error codes are those in the <a href="glib-File-Utilities.html#GFileError"><span class="type">GFileError</span></a> enumeration.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></td>
<td> name of a file to write <em class="parameter"><code>contents</code></em> to, in the GLib file name
  encoding
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>contents</code></em>&#160;:</span></td>
<td> string to write to the file
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>length</code></em>&#160;:</span></td>
<td> length of <em class="parameter"><code>contents</code></em>, or -1 if <em class="parameter"><code>contents</code></em> is a nul-terminated string
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></td>
<td> return location for a <a href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> <a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> on success, <a href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if an error occurred

</td>
</tr>
</tbody>
</table></div>
<p>Since  2.8
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3114456"></a><h3>
<a name="g-file-test"></a>g_file_test ()</h3>
<a class="indexterm" name="id3114466"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboolean</a>    g_file_test                     (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename,
                                             <a href="glib-File-Utilities.html#GFileTest">GFileTest</a> test);</pre>
<p>
Returns <a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if any of the tests in the bitfield <em class="parameter"><code>test</code></em> are
<a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>. For example, <code class="literal">(G_FILE_TEST_EXISTS | 
G_FILE_TEST_IS_DIR)</code> will return <a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the file exists; 
the check whether it's a directory doesn't matter since the existence 
test is <a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>. With the current set of available tests, there's no point
passing in more than one test at a time.
</p>
<p>
Apart from <a href="glib-File-Utilities.html#G-FILE-TEST-IS-SYMLINK:CAPS"><code class="literal">G_FILE_TEST_IS_SYMLINK</code></a> all tests follow symbolic links,
so for a symbolic link to a regular file <a href="glib-File-Utilities.html#g-file-test"><code class="function">g_file_test()</code></a> will return
<a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> for both <a href="glib-File-Utilities.html#G-FILE-TEST-IS-SYMLINK:CAPS"><code class="literal">G_FILE_TEST_IS_SYMLINK</code></a> and <a href="glib-File-Utilities.html#G-FILE-TEST-IS-REGULAR:CAPS"><code class="literal">G_FILE_TEST_IS_REGULAR</code></a>.
</p>
<p>
Note, that for a dangling symbolic link <a href="glib-File-Utilities.html#g-file-test"><code class="function">g_file_test()</code></a> will return
<a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> for <a href="glib-File-Utilities.html#G-FILE-TEST-IS-SYMLINK:CAPS"><code class="literal">G_FILE_TEST_IS_SYMLINK</code></a> and <a href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> for all other flags.
</p>
<p>
You should never use <a href="glib-File-Utilities.html#g-file-test"><code class="function">g_file_test()</code></a> to test whether it is safe
to perform an operation, because there is always the possibility
of the condition changing before you actually perform the operation.
For example, you might think you could use <a href="glib-File-Utilities.html#G-FILE-TEST-IS-SYMLINK:CAPS"><code class="literal">G_FILE_TEST_IS_SYMLINK</code></a>
to know whether it is is safe to write to a file without being
tricked into writing into a different location. It doesn't work!
</p>
<p>
</p>
<div class="informalexample"><pre class="programlisting">
/* DON'T DO THIS */
 if (!g_file_test (filename, G_FILE_TEST_IS_SYMLINK)) {
   fd = g_open (filename, O_WRONLY);
   /* write to fd */
 }
</pre></div>
<p>
</p>
<p>
Another thing to note is that <a href="glib-File-Utilities.html#G-FILE-TEST-EXISTS:CAPS"><code class="literal">G_FILE_TEST_EXISTS</code></a> and
<a href="glib-File-Utilities.html#G-FILE-TEST-IS-EXECUTABLE:CAPS"><code class="literal">G_FILE_TEST_IS_EXECUTABLE</code></a> are implemented using the <code class="function">access()</code>
system call. This usually doesn't matter, but if your program
is setuid or setgid it means that these tests will give you
the answer for the real user ID and group ID, rather than the
effective user ID and group ID.
</p>
<p>
On Windows, there are no symlinks, so testing for
<a href="glib-File-Utilities.html#G-FILE-TEST-IS-SYMLINK:CAPS"><code class="literal">G_FILE_TEST_IS_SYMLINK</code></a> will always return <a href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>. Testing for
<a href="glib-File-Utilities.html#G-FILE-TEST-IS-EXECUTABLE:CAPS"><code class="literal">G_FILE_TEST_IS_EXECUTABLE</code></a> will just check that the file exists and
its name indicates that it is executable, checking for well-known
extensions and those listed in the <code class="literal">PATHEXT</code> environment variable.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></td>
<td> a filename to test in the GLib file name encoding
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>test</code></em>&#160;:</span></td>
<td> bitfield of <a href="glib-File-Utilities.html#GFileTest"><span class="type">GFileTest</span></a> flags
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> whether a test was <a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3114820"></a><h3>
<a name="g-mkstemp"></a>g_mkstemp ()</h3>
<a class="indexterm" name="id3114831"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gint">gint</a>        g_mkstemp                       (<a href="glib-Basic-Types.html#gchar">gchar</a> *tmpl);</pre>
<p>
Opens a temporary file. See the <code class="function">mkstemp()</code> documentation
on most UNIX-like systems. 
</p>
<p>
The parameter is a string that should follow the rules for
<code class="function">mkstemp()</code> templates, i.e. contain the string "XXXXXX". 
<a href="glib-File-Utilities.html#g-mkstemp"><code class="function">g_mkstemp()</code></a> is slightly more flexible than <code class="function">mkstemp()</code>
in that the sequence does not have to occur at the very end of the 
template. The X string will 
be modified to form the name of a file that didn't exist.
The string should be in the GLib file name encoding. Most importantly, 
on Windows it should be in UTF-8.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>tmpl</code></em>&#160;:</span></td>
<td> template filename
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> A file handle (as from <code class="function">open()</code>) to the file
opened for reading and writing. The file is opened in binary mode
on platforms where there is a difference. The file handle should be
closed with <code class="function">close()</code>. In case of errors, -1 is returned.  
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3114950"></a><h3>
<a name="g-file-open-tmp"></a>g_file_open_tmp ()</h3>
<a class="indexterm" name="id3114961"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gint">gint</a>        g_file_open_tmp                 (const <a href="glib-Basic-Types.html#gchar">gchar</a> *tmpl,
                                             <a href="glib-Basic-Types.html#gchar">gchar</a> **name_used,
                                             <a href="glib-Error-Reporting.html#GError">GError</a> **error);</pre>
<p>
Opens a file for writing in the preferred directory for temporary
files (as returned by <a href="glib-Miscellaneous-Utility-Functions.html#g-get-tmp-dir"><code class="function">g_get_tmp_dir()</code></a>). 
</p>
<p>
<em class="parameter"><code>tmpl</code></em> should be a string in the GLib file name encoding containing 
a sequence of six 'X' characters, as the parameter to <a href="glib-File-Utilities.html#g-mkstemp"><code class="function">g_mkstemp()</code></a>.
However, unlike these functions, the template should only be a
basename, no directory components are allowed. If template is
<a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, a default template is used.
</p>
<p>
Note that in contrast to <a href="glib-File-Utilities.html#g-mkstemp"><code class="function">g_mkstemp()</code></a> (and <code class="function">mkstemp()</code>) 
<em class="parameter"><code>tmpl</code></em> is not modified, and might thus be a read-only literal string.
</p>
<p>
The actual name used is returned in <em class="parameter"><code>name_used</code></em> if non-<a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. This
string should be freed with <a href="glib-Memory-Allocation.html#g-free"><code class="function">g_free()</code></a> when not needed any longer.
The returned name is in the GLib file name encoding.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>tmpl</code></em>&#160;:</span></td>
<td> Template for file name, as in <a href="glib-File-Utilities.html#g-mkstemp"><code class="function">g_mkstemp()</code></a>, basename only,
       or <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, to a default template
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>name_used</code></em>&#160;:</span></td>
<td> location to store actual name used
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></td>
<td> return location for a <a href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> A file handle (as from <code class="function">open()</code>) to 
the file opened for reading and writing. The file is opened in binary 
mode on platforms where there is a difference. The file handle should be
closed with <code class="function">close()</code>. In case of errors, -1 is returned 
and <em class="parameter"><code>error</code></em> will be set.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3115228"></a><h3>
<a name="g-file-read-link"></a>g_file_read_link ()</h3>
<a class="indexterm" name="id3115243"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>*      g_file_read_link                (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename,
                                             <a href="glib-Error-Reporting.html#GError">GError</a> **error);</pre>
<p>
Reads the contents of the symbolic link <em class="parameter"><code>filename</code></em> like the POSIX
<code class="function">readlink()</code> function.  The returned string is in the encoding used
for filenames. Use <a href="glib-Character-Set-Conversion.html#g-filename-to-utf8"><code class="function">g_filename_to_utf8()</code></a> to convert it to UTF-8.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></td>
<td> the symbolic link
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></td>
<td> return location for a <a href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> A newly allocated string with the contents of the symbolic link, 
         or <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if an error occurred.

</td>
</tr>
</tbody>
</table></div>
<p>Since  2.4
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3115379"></a><h3>
<a name="g-mkdir-with-parents"></a>g_mkdir_with_parents ()</h3>
<a class="indexterm" name="id3115395"></a><pre class="programlisting">int         g_mkdir_with_parents            (const <a href="glib-Basic-Types.html#gchar">gchar</a> *pathname,
                                             int mode);</pre>
<p>
Create a directory if it doesn't already exist. Create intermediate
parent directories as needed, too.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>pathname</code></em>&#160;:</span></td>
<td> a pathname in the GLib file name encoding
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>mode</code></em>&#160;:</span></td>
<td> permissions to use for newly created directories
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> 0 if the directory already exists, or was successfully
created. Returns -1 if an error occurred, with errno set.

</td>
</tr>
</tbody>
</table></div>
<p>Since  2.8
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3115484"></a><h3>
<a name="GDir"></a>GDir</h3>
<a class="indexterm" name="id3115497"></a><pre class="programlisting">typedef struct _GDir GDir;</pre>
<p>
An opaque structure representing an opened directory.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3115513"></a><h3>
<a name="g-dir-open"></a>g_dir_open ()</h3>
<a class="indexterm" name="id3115526"></a><pre class="programlisting"><a href="glib-File-Utilities.html#GDir">GDir</a>*       g_dir_open                      (const <a href="glib-Basic-Types.html#gchar">gchar</a> *path,
                                             <a href="glib-Basic-Types.html#guint">guint</a> flags,
                                             <a href="glib-Error-Reporting.html#GError">GError</a> **error);</pre>
<p>
Opens a directory for reading. The names of the files in the
directory can then be retrieved using <a href="glib-File-Utilities.html#g-dir-read-name"><code class="function">g_dir_read_name()</code></a>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>path</code></em>&#160;:</span></td>
<td> the path to the directory you are interested in. On Unix
        in the on-disk encoding. On Windows in UTF-8
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>flags</code></em>&#160;:</span></td>
<td> Currently must be set to 0. Reserved for future use.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></td>
<td> return location for a <a href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.
        If non-<a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, an error will be set if and only if
        <a href="glib-File-Utilities.html#g-dir-open"><code class="function">g_dir_open()</code></a> fails.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> a newly allocated <a href="glib-File-Utilities.html#GDir"><span class="type">GDir</span></a> on success, <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on failure.
  If non-<a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, you must free the result with <a href="glib-File-Utilities.html#g-dir-close"><code class="function">g_dir_close()</code></a>
  when you are finished with it.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3115723"></a><h3>
<a name="g-dir-read-name"></a>g_dir_read_name ()</h3>
<a class="indexterm" name="id3115736"></a><pre class="programlisting">const <a href="glib-Basic-Types.html#gchar">gchar</a>* g_dir_read_name                (<a href="glib-File-Utilities.html#GDir">GDir</a> *dir);</pre>
<p>
Retrieves the name of the next entry in the directory.  The '.' and
'..' entries are omitted. On Windows, the returned name is in
UTF-8. On Unix, it is in the on-disk encoding.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>dir</code></em>&#160;:</span></td>
<td> a <a href="glib-File-Utilities.html#GDir"><span class="type">GDir</span></a>* created by <a href="glib-File-Utilities.html#g-dir-open"><code class="function">g_dir_open()</code></a>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> The entry's name or <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if there are no 
  more entries. The return value is owned by GLib and
  must not be modified or freed.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3115830"></a><h3>
<a name="g-dir-rewind"></a>g_dir_rewind ()</h3>
<a class="indexterm" name="id3115843"></a><pre class="programlisting">void        g_dir_rewind                    (<a href="glib-File-Utilities.html#GDir">GDir</a> *dir);</pre>
<p>
Resets the given directory. The next call to <a href="glib-File-Utilities.html#g-dir-read-name"><code class="function">g_dir_read_name()</code></a>
will return the first entry again.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>dir</code></em>&#160;:</span></td>
<td> a <a href="glib-File-Utilities.html#GDir"><span class="type">GDir</span></a>* created by <a href="glib-File-Utilities.html#g-dir-open"><code class="function">g_dir_open()</code></a>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3115922"></a><h3>
<a name="g-dir-close"></a>g_dir_close ()</h3>
<a class="indexterm" name="id3115935"></a><pre class="programlisting">void        g_dir_close                     (<a href="glib-File-Utilities.html#GDir">GDir</a> *dir);</pre>
<p>
Closes the directory and deallocates all related resources.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>dir</code></em>&#160;:</span></td>
<td> a <a href="glib-File-Utilities.html#GDir"><span class="type">GDir</span></a>* created by <a href="glib-File-Utilities.html#g-dir-open"><code class="function">g_dir_open()</code></a>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3116003"></a><h3>
<a name="GMappedFile"></a>GMappedFile</h3>
<a class="indexterm" name="id3116016"></a><pre class="programlisting">typedef struct _GMappedFile GMappedFile;</pre>
<p>
The <a href="glib-File-Utilities.html#GMappedFile"><span class="type">GMappedFile</span></a> represents a file mapping created with
<a href="glib-File-Utilities.html#g-mapped-file-new"><code class="function">g_mapped_file_new()</code></a>. It has only private members and should
not be accessed directly.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3116051"></a><h3>
<a name="g-mapped-file-new"></a>g_mapped_file_new ()</h3>
<a class="indexterm" name="id3116067"></a><pre class="programlisting"><a href="glib-File-Utilities.html#GMappedFile">GMappedFile</a>* g_mapped_file_new              (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename,
                                             <a href="glib-Basic-Types.html#gboolean">gboolean</a> writable,
                                             <a href="glib-Error-Reporting.html#GError">GError</a> **error);</pre>
<p>
Maps a file into memory. On UNIX, this is using the <code class="function">mmap()</code> function.
</p>
<p>
If <em class="parameter"><code>writable</code></em> is <a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>, the mapped buffer may be modified, otherwise
it is an error to modify the mapped buffer. Modifications to the buffer 
are not visible to other processes mapping the same file, and are not 
written back to the file.
</p>
<p>
Note that modifications of the underlying file might affect the contents
of the <a href="glib-File-Utilities.html#GMappedFile"><span class="type">GMappedFile</span></a>. Therefore, mapping should only be used if the file 
will not be modified, or if all modifications of the file are done
atomically (e.g. using <a href="glib-File-Utilities.html#g-file-set-contents"><code class="function">g_file_set_contents()</code></a>).</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></td>
<td> The path of the file to load, in the GLib filename encoding
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>writable</code></em>&#160;:</span></td>
<td> wether the mapping should be writable
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></td>
<td> return location for a <a href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> a newly allocated <a href="glib-File-Utilities.html#GMappedFile"><span class="type">GMappedFile</span></a> which must be freed
   with <a href="glib-File-Utilities.html#g-mapped-file-free"><code class="function">g_mapped_file_free()</code></a>, or <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if the mapping failed. 

</td>
</tr>
</tbody>
</table></div>
<p>Since  2.8
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3116284"></a><h3>
<a name="g-mapped-file-free"></a>g_mapped_file_free ()</h3>
<a class="indexterm" name="id3116300"></a><pre class="programlisting">void        g_mapped_file_free              (<a href="glib-File-Utilities.html#GMappedFile">GMappedFile</a> *file);</pre>
<p>
Unmaps the buffer of <em class="parameter"><code>file</code></em> and frees it.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>file</code></em>&#160;:</span></td>
<td> a <a href="glib-File-Utilities.html#GMappedFile"><span class="type">GMappedFile</span></a>
</td>
</tr></tbody>
</table></div>
<p>Since  2.8
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3116367"></a><h3>
<a name="g-mapped-file-get-length"></a>g_mapped_file_get_length ()</h3>
<a class="indexterm" name="id3116383"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gsize">gsize</a>       g_mapped_file_get_length        (<a href="glib-File-Utilities.html#GMappedFile">GMappedFile</a> *file);</pre>
<p>
Returns the length of the contents of a <a href="glib-File-Utilities.html#GMappedFile"><span class="type">GMappedFile</span></a>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>file</code></em>&#160;:</span></td>
<td> a <a href="glib-File-Utilities.html#GMappedFile"><span class="type">GMappedFile</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> the length of the contents of <em class="parameter"><code>file</code></em>.

</td>
</tr>
</tbody>
</table></div>
<p>Since  2.8
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3116469"></a><h3>
<a name="g-mapped-file-get-contents"></a>g_mapped_file_get_contents ()</h3>
<a class="indexterm" name="id3116486"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>*      g_mapped_file_get_contents      (<a href="glib-File-Utilities.html#GMappedFile">GMappedFile</a> *file);</pre>
<p>
Returns the contents of a <a href="glib-File-Utilities.html#GMappedFile"><span class="type">GMappedFile</span></a>. 
</p>
<p>
Note that the contents may not be zero-terminated,
even if the <a href="glib-File-Utilities.html#GMappedFile"><span class="type">GMappedFile</span></a> is backed by a text file.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>file</code></em>&#160;:</span></td>
<td> a <a href="glib-File-Utilities.html#GMappedFile"><span class="type">GMappedFile</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> the contents of <em class="parameter"><code>file</code></em>.

</td>
</tr>
</tbody>
</table></div>
<p>Since  2.8
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3116584"></a><h3>
<a name="g-open"></a>g_open ()</h3>
<a class="indexterm" name="id3116598"></a><pre class="programlisting">int         g_open                          (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename,
                                             int flags,
                                             int mode);</pre>
<p>
A wrapper for the POSIX <code class="function">open()</code> function. The <code class="function">open()</code> function is
used to convert a pathname into a file descriptor. Note that on
POSIX systems file descriptors are implemented by the operating
system. On Windows, it's the C library that implements <code class="function">open()</code> and
file descriptors. The actual Windows API for opening files is
something different.
</p>
<p>
See the C library manual for more details about <code class="function">open()</code>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></td>
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>flags</code></em>&#160;:</span></td>
<td> as in <code class="function">open()</code>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>mode</code></em>&#160;:</span></td>
<td> as in <code class="function">open()</code>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> a new file descriptor, or -1 if an error occurred. The
return value can be used exactly like the return value from <code class="function">open()</code>.

</td>
</tr>
</tbody>
</table></div>
<p>Since  2.6
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3116787"></a><h3>
<a name="g-rename"></a>g_rename ()</h3>
<a class="indexterm" name="id3116802"></a><pre class="programlisting">int         g_rename                        (const <a href="glib-Basic-Types.html#gchar">gchar</a> *oldfilename,
                                             const <a href="glib-Basic-Types.html#gchar">gchar</a> *newfilename);</pre>
<p>
A wrapper for the POSIX <code class="function">rename()</code> function. The <code class="function">rename()</code> function 
renames a file, moving it between directories if required.
</p>
<p>
See your C library manual for more details about how <code class="function">rename()</code> works
on your system. Note in particular that on Win9x it is not possible
to rename a file if a file with the new name already exists. Also
it is not possible in general on Windows to rename an open file.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>oldfilename</code></em>&#160;:</span></td>
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>newfilename</code></em>&#160;:</span></td>
<td> a pathname in the GLib file name encoding
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> 0 if the renaming succeeded, -1 if an error occurred

</td>
</tr>
</tbody>
</table></div>
<p>Since  2.6
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3116931"></a><h3>
<a name="g-mkdir"></a>g_mkdir ()</h3>
<a class="indexterm" name="id3116946"></a><pre class="programlisting">int         g_mkdir                         (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename,
                                             int mode);</pre>
<p>
A wrapper for the POSIX <code class="function">mkdir()</code> function. The <code class="function">mkdir()</code> function 
attempts to create a directory with the given name and permissions.
</p>
<p>
See the C library manual for more details about <code class="function">mkdir()</code>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></td>
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>mode</code></em>&#160;:</span></td>
<td> permissions to use for the newly created directory
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> 0 if the directory was successfully created, -1 if an error 
   occurred

</td>
</tr>
</tbody>
</table></div>
<p>Since  2.6
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3117070"></a><h3>
<a name="g-stat"></a>g_stat ()</h3>
<a class="indexterm" name="id3117085"></a><pre class="programlisting">int         g_stat                          (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename,
                                             struct stat *buf);</pre>
<p>
A wrapper for the POSIX <code class="function">stat()</code> function. The <code class="function">stat()</code> function 
returns information about a file.
</p>
<p>
See the C library manual for more details about <code class="function">stat()</code>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></td>
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>buf</code></em>&#160;:</span></td>
<td> a pointer to a <span class="structname">stat</span> struct, which
   will be filled with the file information
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> 0 if the information was successfully retrieved, -1 if an error 
   occurred

</td>
</tr>
</tbody>
</table></div>
<p>Since  2.6
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3117214"></a><h3>
<a name="g-lstat"></a>g_lstat ()</h3>
<a class="indexterm" name="id3117229"></a><pre class="programlisting">int         g_lstat                         (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename,
                                             struct stat *buf);</pre>
<p>
A wrapper for the POSIX <code class="function">lstat()</code> function. The <code class="function">lstat()</code> function is
like <code class="function">stat()</code> except that in the case of symbolic links, it returns
information about the symbolic link itself and not the file that it
refers to. If the system does not support symbolic links <a href="glib-File-Utilities.html#g-lstat"><code class="function">g_lstat()</code></a>
is identical to <a href="glib-File-Utilities.html#g-stat"><code class="function">g_stat()</code></a>.
</p>
<p>
See the C library manual for more details about <code class="function">lstat()</code>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></td>
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>buf</code></em>&#160;:</span></td>
<td> a pointer to a <span class="structname">stat</span> struct, which
   will be filled with the file information
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> 0 if the information was successfully retrieved, -1 if an error 
   occurred

</td>
</tr>
</tbody>
</table></div>
<p>Since  2.6
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3117391"></a><h3>
<a name="g-unlink"></a>g_unlink ()</h3>
<a class="indexterm" name="id3117406"></a><pre class="programlisting">int         g_unlink                        (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename);</pre>
<p>
A wrapper for the POSIX <code class="function">unlink()</code> function. The <code class="function">unlink()</code> function 
deletes a name from the filesystem. If this was the last link to the 
file and no processes have it opened, the diskspace occupied by the
file is freed.
</p>
<p>
See your C library manual for more details about <code class="function">unlink()</code>. Note
that on Windows, it is in general not possible to delete files that
are open to some process, or mapped into memory.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></td>
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> 0 if the name was successfully deleted, -1 if an error 
   occurred

</td>
</tr>
</tbody>
</table></div>
<p>Since  2.6
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3117512"></a><h3>
<a name="g-remove"></a>g_remove ()</h3>
<a class="indexterm" name="id3117527"></a><pre class="programlisting">int         g_remove                        (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename);</pre>
<p>
A wrapper for the POSIX <code class="function">remove()</code> function. The <code class="function">remove()</code> function
deletes a name from the filesystem.
</p>
<p>
See your C library manual for more details about how <code class="function">remove()</code> works
on your system. On Unix, <code class="function">remove()</code> removes also directories, as it
calls <code class="function">unlink()</code> for files and <code class="function">rmdir()</code> for directories. On Windows,
although <code class="function">remove()</code> in the C library only works for files, this
function tries first <code class="function">remove()</code> and then if that fails <code class="function">rmdir()</code>, and
thus works for both files and directories. Note however, that on
Windows, it is in general not possible to remove a file that is
open to some process, or mapped into memory.
</p>
<p>
If this function fails on Windows you can't infer too much from the
errno value. <code class="function">rmdir()</code> is tried regardless of what caused <code class="function">remove()</code> to
fail. Any errno value set by <code class="function">remove()</code> will be overwritten by that
set by <code class="function">rmdir()</code>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></td>
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> 0 if the file was successfully removed, -1 if an error 
   occurred

</td>
</tr>
</tbody>
</table></div>
<p>Since  2.6
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3117746"></a><h3>
<a name="g-rmdir"></a>g_rmdir ()</h3>
<a class="indexterm" name="id3117761"></a><pre class="programlisting">int         g_rmdir                         (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename);</pre>
<p>
A wrapper for the POSIX <code class="function">rmdir()</code> function. The <code class="function">rmdir()</code> function
deletes a directory from the filesystem.
</p>
<p>
See your C library manual for more details about how <code class="function">rmdir()</code> works
on your system.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></td>
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> 0 if the directory was successfully removed, -1 if an error 
   occurred

</td>
</tr>
</tbody>
</table></div>
<p>Since  2.6
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3117864"></a><h3>
<a name="g-fopen"></a>g_fopen ()</h3>
<a class="indexterm" name="id3117878"></a><pre class="programlisting">FILE*       g_fopen                         (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename,
                                             const <a href="glib-Basic-Types.html#gchar">gchar</a> *mode);</pre>
<p>
A wrapper for the POSIX <code class="function">fopen()</code> function. The <code class="function">fopen()</code> function opens
a file and associates a new stream with it. 
</p>
<p>
See the C library manual for more details about <code class="function">fopen()</code>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></td>
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>mode</code></em>&#160;:</span></td>
<td> a string describing the mode in which the file should be 
  opened
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> A <span class="type">FILE</span> pointer if the file was successfully
   opened, or <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if an error occurred

</td>
</tr>
</tbody>
</table></div>
<p>Since  2.6
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3118017"></a><h3>
<a name="g-freopen"></a>g_freopen ()</h3>
<a class="indexterm" name="id3118032"></a><pre class="programlisting">FILE*       g_freopen                       (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename,
                                             const <a href="glib-Basic-Types.html#gchar">gchar</a> *mode,
                                             FILE *stream);</pre>
<p>
A wrapper for the POSIX <code class="function">freopen()</code> function. The <code class="function">freopen()</code> function
opens a file and associates it with an existing stream.
</p>
<p>
See the C library manual for more details about <code class="function">freopen()</code>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></td>
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>mode</code></em>&#160;:</span></td>
<td> a string describing the mode in which the file should be 
  opened
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>stream</code></em>&#160;:</span></td>
<td> an existing stream which will be reused, or <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> A <span class="type">FILE</span> pointer if the file was successfully
   opened, or <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if an error occurred.

</td>
</tr>
</tbody>
</table></div>
<p>Since  2.6
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3118204"></a><h3>
<a name="g-chmod"></a>g_chmod ()</h3>
<a class="indexterm" name="id3118219"></a><pre class="programlisting">int         g_chmod                         (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename,
                                             int mode);</pre>
<p>
A wrapper for the POSIX <code class="function">chmod()</code> function. The <code class="function">chmod()</code> function is
used to set the permissions of a file system object. Note that on
Windows the file protection mechanism is not at all POSIX-like, and
the underlying <code class="function">chmod()</code> function in the C library just sets or
clears the READONLY attribute. It does not touch any ACL. Software
that needs to manage file permissions on Windows exactly should
use the Win32 API.
</p>
<p>
See the C library manual for more details about <code class="function">chmod()</code>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></td>
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>mode</code></em>&#160;:</span></td>
<td> as in <code class="function">chmod()</code>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> zero if the operation succeeded, -1 on error.

</td>
</tr>
</tbody>
</table></div>
<p>Since  2.8
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3118368"></a><h3>
<a name="g-access"></a>g_access ()</h3>
<a class="indexterm" name="id3118383"></a><pre class="programlisting">int         g_access                        (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename,
                                             int mode);</pre>
<p>
A wrapper for the POSIX <code class="function">access()</code> function. This function is used to
test a pathname for one or several of read, write or execute
permissions, or just existence. On Windows, the underlying <code class="function">access()</code>
function in the C library only checks the READONLY attribute, and
does not look at the ACL at all. Software that needs to handle file
permissions on Windows more exactly should use the Win32 API.
</p>
<p>
See the C library manual for more details about <code class="function">access()</code>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></td>
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>mode</code></em>&#160;:</span></td>
<td> as in <code class="function">access()</code>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> zero if the pathname refers to an existing file system
object that has all the tested permissions, or -1 otherwise or on
error.

</td>
</tr>
</tbody>
</table></div>
<p>Since  2.8
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3118521"></a><h3>
<a name="g-creat"></a>g_creat ()</h3>
<a class="indexterm" name="id3118536"></a><pre class="programlisting">int         g_creat                         (const <a href="glib-Basic-Types.html#gchar">gchar</a> *filename,
                                             int mode);</pre>
<p>
A wrapper for the POSIX <code class="function">creat()</code> function. The <code class="function">creat()</code> function is
used to convert a pathname into a file descriptor, creating a file
if necessar. Note that on POSIX systems file descriptors are
implemented by the operating system. On Windows, it's the C library
that implements <code class="function">creat()</code> and file descriptors. The actual Windows
API for opening files is something different.
</p>
<p>
See the C library manual for more details about <code class="function">creat()</code>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></td>
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>mode</code></em>&#160;:</span></td>
<td> as in <code class="function">creat()</code>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> a new file descriptor, or -1 if an error occurred. The
return value can be used exactly like the return value from <code class="function">creat()</code>.

</td>
</tr>
</tbody>
</table></div>
<p>Since  2.8
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3118694"></a><h3>
<a name="g-chdir"></a>g_chdir ()</h3>
<a class="indexterm" name="id2801124"></a><pre class="programlisting">int         g_chdir                         (const <a href="glib-Basic-Types.html#gchar">gchar</a> *path);</pre>
<p>
A wrapper for the POSIX <code class="function">chdir()</code> function. The function changes the
current directory of the process to <em class="parameter"><code>path</code></em>.
</p>
<p>
See your C library manual for more details about <code class="function">chdir()</code>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>path</code></em>&#160;:</span></td>
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> 0 on success, -1 if an error occurred.

</td>
</tr>
</tbody>
</table></div>
<p>Since  2.8
</p>
</div>
</div>
</div>
</body>
</html>

Anon7 - 2021