~ubuntu-branches/debian/jessie/glib2.0/jessie

« back to all changes in this revision

Viewing changes to docs/reference/glib/html/glib-File-Utilities.html

  • Committer: Bazaar Package Importer
  • Author(s): Gustavo Noronha Silva
  • Date: 2009-02-15 13:00:43 UTC
  • mto: (1.4.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 70.
  • Revision ID: james.westby@ubuntu.com-20090215130043-6snh45flhit8oalb
Tags: upstream-2.18.4
Import upstream version 2.18.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
2
<html>
3
3
<head>
4
 
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
 
4
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
5
<title>File Utilities</title>
6
 
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2">
7
 
<link rel="start" href="index.html" title="GLib Reference Manual">
 
6
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
 
7
<link rel="home" href="index.html" title="GLib Reference Manual">
8
8
<link rel="up" href="glib-utilities.html" title="GLib Utilities">
9
9
<link rel="prev" href="glib-Spawning-Processes.html" title="Spawning Processes">
10
10
<link rel="next" href="glib-URI-Functions.html" title="URI Functions">
11
 
<meta name="generator" content="GTK-Doc V1.9 (XML mode)">
 
11
<meta name="generator" content="GTK-Doc V1.11 (XML mode)">
12
12
<link rel="stylesheet" href="style.css" type="text/css">
13
13
<link rel="chapter" href="glib.html" title="GLib Overview">
14
14
<link rel="chapter" href="glib-fundamentals.html" title="GLib Fundamentals">
26
26
<link rel="index" href="ix08.html" title="Index of new symbols in 2.12">
27
27
<link rel="index" href="ix09.html" title="Index of new symbols in 2.14">
28
28
<link rel="index" href="ix10.html" title="Index of new symbols in 2.16">
 
29
<link rel="index" href="ix11.html" title="Index of new symbols in 2.18">
29
30
</head>
30
31
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
31
32
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
36
37
<th width="100%" align="center">GLib Reference Manual</th>
37
38
<td><a accesskey="n" href="glib-URI-Functions.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
38
39
</tr>
39
 
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id3163988" class="shortcut">Top</a>
40
 
                  &#160;|&#160;
41
 
                  <a href="#id2864430" class="shortcut">Description</a></nobr></td></tr>
 
40
<tr><td colspan="5" class="shortcuts">
 
41
<a href="#glib-File-Utilities.synopsis" class="shortcut">Top</a>
 
42
                 | 
 
43
                <a href="#glib-File-Utilities.description" class="shortcut">Description</a>
 
44
</td></tr>
42
45
</table>
43
46
<div class="refentry" lang="en">
44
47
<a name="glib-File-Utilities"></a><div class="titlepage"></div>
45
48
<div class="refnamediv"><table width="100%"><tr>
46
49
<td valign="top">
47
 
<h2>
48
 
<a name="id3163988"></a><span class="refentrytitle">File Utilities</span>
49
 
</h2>
50
 
<p>File Utilities &#8212; various file-related functions</p>
 
50
<h2><span class="refentrytitle"><a name="glib-File-Utilities.top_of_page"></a>File Utilities</span></h2>
 
51
<p>File Utilities — various file-related functions</p>
51
52
</td>
52
53
<td valign="top" align="right"></td>
53
54
</tr></table></div>
54
55
<div class="refsynopsisdiv">
55
 
<h2>Synopsis</h2>
 
56
<a name="glib-File-Utilities.synopsis"></a><h2>Synopsis</h2>
56
57
<pre class="synopsis">
57
58
 
58
59
#include &lt;glib.h&gt;
59
60
#include &lt;glib/gstdio.h&gt;
60
61
 
61
 
 
62
 
enum                <a class="link" href="glib-File-Utilities.html#GFileError">GFileError</a>;
63
 
#define             <a class="link" href="glib-File-Utilities.html#G-FILE-ERROR:CAPS">G_FILE_ERROR</a>
64
 
enum                <a class="link" href="glib-File-Utilities.html#GFileTest">GFileTest</a>;
65
 
<a class="link" href="glib-File-Utilities.html#GFileError">GFileError</a>          <a class="link" href="glib-File-Utilities.html#g-file-error-from-errno">g_file_error_from_errno</a>             (<a class="link" href="glib-Basic-Types.html#gint">gint</a> err_no);
66
 
<a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a>            <a class="link" href="glib-File-Utilities.html#g-file-get-contents">g_file_get_contents</a>                 (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename,
67
 
                                                         <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> **contents,
68
 
                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> *length,
69
 
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);
70
 
<a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a>            <a class="link" href="glib-File-Utilities.html#g-file-set-contents">g_file_set_contents</a>                 (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename,
71
 
                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *contents,
72
 
                                                         <a class="link" href="glib-Basic-Types.html#gssize">gssize</a> length,
73
 
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);
74
 
<a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a>            <a class="link" href="glib-File-Utilities.html#g-file-test">g_file_test</a>                         (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename,
75
 
                                                         <a class="link" href="glib-File-Utilities.html#GFileTest">GFileTest</a> test);
76
 
<a class="link" href="glib-Basic-Types.html#gint">gint</a>                <a class="link" href="glib-File-Utilities.html#g-mkstemp">g_mkstemp</a>                           (<a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *tmpl);
77
 
<a class="link" href="glib-Basic-Types.html#gint">gint</a>                <a class="link" href="glib-File-Utilities.html#g-file-open-tmp">g_file_open_tmp</a>                     (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *tmpl,
78
 
                                                         <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> **name_used,
79
 
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);
80
 
<a class="link" href="glib-Basic-Types.html#gchar">gchar</a>*              <a class="link" href="glib-File-Utilities.html#g-file-read-link">g_file_read_link</a>                    (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename,
81
 
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);
82
 
int                 <a class="link" href="glib-File-Utilities.html#g-mkdir-with-parents">g_mkdir_with_parents</a>                (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *pathname,
 
62
enum                <a class="link" href="glib-File-Utilities.html#GFileError" title="enum GFileError">GFileError</a>;
 
63
#define             <a class="link" href="glib-File-Utilities.html#G-FILE-ERROR--CAPS" title="G_FILE_ERROR">G_FILE_ERROR</a>
 
64
enum                <a class="link" href="glib-File-Utilities.html#GFileTest" title="enum GFileTest">GFileTest</a>;
 
65
<a class="link" href="glib-File-Utilities.html#GFileError" title="enum GFileError">GFileError</a>          <a class="link" href="glib-File-Utilities.html#g-file-error-from-errno" title="g_file_error_from_errno ()">g_file_error_from_errno</a>             (<a class="link" href="glib-Basic-Types.html#gint" title="gint">gint</a> err_no);
 
66
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean">gboolean</a>            <a class="link" href="glib-File-Utilities.html#g-file-get-contents" title="g_file_get_contents ()">g_file_get_contents</a>                 (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
 
67
                                                         <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> **contents,
 
68
                                                         <a class="link" href="glib-Basic-Types.html#gsize" title="gsize">gsize</a> *length,
 
69
                                                         <a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);
 
70
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean">gboolean</a>            <a class="link" href="glib-File-Utilities.html#g-file-set-contents" title="g_file_set_contents ()">g_file_set_contents</a>                 (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
 
71
                                                         const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *contents,
 
72
                                                         <a class="link" href="glib-Basic-Types.html#gssize" title="gssize">gssize</a> length,
 
73
                                                         <a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);
 
74
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean">gboolean</a>            <a class="link" href="glib-File-Utilities.html#g-file-test" title="g_file_test ()">g_file_test</a>                         (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
 
75
                                                         <a class="link" href="glib-File-Utilities.html#GFileTest" title="enum GFileTest">GFileTest</a> test);
 
76
<a class="link" href="glib-Basic-Types.html#gint" title="gint">gint</a>                <a class="link" href="glib-File-Utilities.html#g-mkstemp" title="g_mkstemp ()">g_mkstemp</a>                           (<a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *tmpl);
 
77
<a class="link" href="glib-Basic-Types.html#gint" title="gint">gint</a>                <a class="link" href="glib-File-Utilities.html#g-file-open-tmp" title="g_file_open_tmp ()">g_file_open_tmp</a>                     (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *tmpl,
 
78
                                                         <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> **name_used,
 
79
                                                         <a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);
 
80
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *             <a class="link" href="glib-File-Utilities.html#g-file-read-link" title="g_file_read_link ()">g_file_read_link</a>                    (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
 
81
                                                         <a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);
 
82
int                 <a class="link" href="glib-File-Utilities.html#g-mkdir-with-parents" title="g_mkdir_with_parents ()">g_mkdir_with_parents</a>                (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *pathname,
83
83
                                                         int mode);
84
84
 
85
 
                    <a class="link" href="glib-File-Utilities.html#GDir">GDir</a>;
86
 
<a class="link" href="glib-File-Utilities.html#GDir">GDir</a>*               <a class="link" href="glib-File-Utilities.html#g-dir-open">g_dir_open</a>                          (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *path,
87
 
                                                         <a class="link" href="glib-Basic-Types.html#guint">guint</a> flags,
88
 
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);
89
 
const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a>*        <a class="link" href="glib-File-Utilities.html#g-dir-read-name">g_dir_read_name</a>                     (<a class="link" href="glib-File-Utilities.html#GDir">GDir</a> *dir);
90
 
void                <a class="link" href="glib-File-Utilities.html#g-dir-rewind">g_dir_rewind</a>                        (<a class="link" href="glib-File-Utilities.html#GDir">GDir</a> *dir);
91
 
void                <a class="link" href="glib-File-Utilities.html#g-dir-close">g_dir_close</a>                         (<a class="link" href="glib-File-Utilities.html#GDir">GDir</a> *dir);
92
 
 
93
 
                    <a class="link" href="glib-File-Utilities.html#GMappedFile">GMappedFile</a>;
94
 
<a class="link" href="glib-File-Utilities.html#GMappedFile">GMappedFile</a>*        <a class="link" href="glib-File-Utilities.html#g-mapped-file-new">g_mapped_file_new</a>                   (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename,
95
 
                                                         <a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> writable,
96
 
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);
97
 
void                <a class="link" href="glib-File-Utilities.html#g-mapped-file-free">g_mapped_file_free</a>                  (<a class="link" href="glib-File-Utilities.html#GMappedFile">GMappedFile</a> *file);
98
 
<a class="link" href="glib-Basic-Types.html#gsize">gsize</a>               <a class="link" href="glib-File-Utilities.html#g-mapped-file-get-length">g_mapped_file_get_length</a>            (<a class="link" href="glib-File-Utilities.html#GMappedFile">GMappedFile</a> *file);
99
 
<a class="link" href="glib-Basic-Types.html#gchar">gchar</a>*              <a class="link" href="glib-File-Utilities.html#g-mapped-file-get-contents">g_mapped_file_get_contents</a>          (<a class="link" href="glib-File-Utilities.html#GMappedFile">GMappedFile</a> *file);
100
 
 
101
 
int                 <a class="link" href="glib-File-Utilities.html#g-open">g_open</a>                              (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename,
 
85
                    <a class="link" href="glib-File-Utilities.html#GDir" title="GDir">GDir</a>;
 
86
<a class="link" href="glib-File-Utilities.html#GDir" title="GDir">GDir</a> *              <a class="link" href="glib-File-Utilities.html#g-dir-open" title="g_dir_open ()">g_dir_open</a>                          (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *path,
 
87
                                                         <a class="link" href="glib-Basic-Types.html#guint" title="guint">guint</a> flags,
 
88
                                                         <a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);
 
89
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *       <a class="link" href="glib-File-Utilities.html#g-dir-read-name" title="g_dir_read_name ()">g_dir_read_name</a>                     (<a class="link" href="glib-File-Utilities.html#GDir" title="GDir">GDir</a> *dir);
 
90
void                <a class="link" href="glib-File-Utilities.html#g-dir-rewind" title="g_dir_rewind ()">g_dir_rewind</a>                        (<a class="link" href="glib-File-Utilities.html#GDir" title="GDir">GDir</a> *dir);
 
91
void                <a class="link" href="glib-File-Utilities.html#g-dir-close" title="g_dir_close ()">g_dir_close</a>                         (<a class="link" href="glib-File-Utilities.html#GDir" title="GDir">GDir</a> *dir);
 
92
 
 
93
                    <a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile">GMappedFile</a>;
 
94
<a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile">GMappedFile</a> *       <a class="link" href="glib-File-Utilities.html#g-mapped-file-new" title="g_mapped_file_new ()">g_mapped_file_new</a>                   (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
 
95
                                                         <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean">gboolean</a> writable,
 
96
                                                         <a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);
 
97
void                <a class="link" href="glib-File-Utilities.html#g-mapped-file-free" title="g_mapped_file_free ()">g_mapped_file_free</a>                  (<a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile">GMappedFile</a> *file);
 
98
<a class="link" href="glib-Basic-Types.html#gsize" title="gsize">gsize</a>               <a class="link" href="glib-File-Utilities.html#g-mapped-file-get-length" title="g_mapped_file_get_length ()">g_mapped_file_get_length</a>            (<a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile">GMappedFile</a> *file);
 
99
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *             <a class="link" href="glib-File-Utilities.html#g-mapped-file-get-contents" title="g_mapped_file_get_contents ()">g_mapped_file_get_contents</a>          (<a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile">GMappedFile</a> *file);
 
100
 
 
101
int                 <a class="link" href="glib-File-Utilities.html#g-open" title="g_open ()">g_open</a>                              (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
102
102
                                                         int flags,
103
103
                                                         int mode);
104
 
int                 <a class="link" href="glib-File-Utilities.html#g-rename">g_rename</a>                            (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *oldfilename,
105
 
                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *newfilename);
106
 
int                 <a class="link" href="glib-File-Utilities.html#g-mkdir">g_mkdir</a>                             (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename,
 
104
int                 <a class="link" href="glib-File-Utilities.html#g-rename" title="g_rename ()">g_rename</a>                            (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *oldfilename,
 
105
                                                         const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *newfilename);
 
106
int                 <a class="link" href="glib-File-Utilities.html#g-mkdir" title="g_mkdir ()">g_mkdir</a>                             (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
107
107
                                                         int mode);
108
 
int                 <a class="link" href="glib-File-Utilities.html#g-stat">g_stat</a>                              (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename,
109
 
                                                         struct stat *buf);
110
 
int                 <a class="link" href="glib-File-Utilities.html#g-lstat">g_lstat</a>                             (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename,
111
 
                                                         struct stat *buf);
112
 
int                 <a class="link" href="glib-File-Utilities.html#g-unlink">g_unlink</a>                            (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename);
113
 
int                 <a class="link" href="glib-File-Utilities.html#g-remove">g_remove</a>                            (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename);
114
 
int                 <a class="link" href="glib-File-Utilities.html#g-rmdir">g_rmdir</a>                             (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename);
115
 
FILE*               <a class="link" href="glib-File-Utilities.html#g-fopen">g_fopen</a>                             (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename,
116
 
                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *mode);
117
 
FILE*               <a class="link" href="glib-File-Utilities.html#g-freopen">g_freopen</a>                           (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename,
118
 
                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *mode,
 
108
int                 <a class="link" href="glib-File-Utilities.html#g-stat" title="g_stat ()">g_stat</a>                              (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
 
109
                                                         struct stat *buf);
 
110
int                 <a class="link" href="glib-File-Utilities.html#g-lstat" title="g_lstat ()">g_lstat</a>                             (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
 
111
                                                         struct stat *buf);
 
112
int                 <a class="link" href="glib-File-Utilities.html#g-unlink" title="g_unlink ()">g_unlink</a>                            (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename);
 
113
int                 <a class="link" href="glib-File-Utilities.html#g-remove" title="g_remove ()">g_remove</a>                            (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename);
 
114
int                 <a class="link" href="glib-File-Utilities.html#g-rmdir" title="g_rmdir ()">g_rmdir</a>                             (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename);
 
115
FILE *              <a class="link" href="glib-File-Utilities.html#g-fopen" title="g_fopen ()">g_fopen</a>                             (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
 
116
                                                         const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *mode);
 
117
FILE *              <a class="link" href="glib-File-Utilities.html#g-freopen" title="g_freopen ()">g_freopen</a>                           (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
 
118
                                                         const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *mode,
119
119
                                                         FILE *stream);
120
 
int                 <a class="link" href="glib-File-Utilities.html#g-chmod">g_chmod</a>                             (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename,
121
 
                                                         int mode);
122
 
int                 <a class="link" href="glib-File-Utilities.html#g-access">g_access</a>                            (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename,
123
 
                                                         int mode);
124
 
int                 <a class="link" href="glib-File-Utilities.html#g-creat">g_creat</a>                             (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename,
125
 
                                                         int mode);
126
 
int                 <a class="link" href="glib-File-Utilities.html#g-chdir">g_chdir</a>                             (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *path);
127
 
 
 
120
int                 <a class="link" href="glib-File-Utilities.html#g-chmod" title="g_chmod ()">g_chmod</a>                             (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
 
121
                                                         int mode);
 
122
int                 <a class="link" href="glib-File-Utilities.html#g-access" title="g_access ()">g_access</a>                            (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
 
123
                                                         int mode);
 
124
int                 <a class="link" href="glib-File-Utilities.html#g-creat" title="g_creat ()">g_creat</a>                             (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
 
125
                                                         int mode);
 
126
int                 <a class="link" href="glib-File-Utilities.html#g-chdir" title="g_chdir ()">g_chdir</a>                             (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *path);
 
127
int                 <a class="link" href="glib-File-Utilities.html#g-utime" title="g_utime ()">g_utime</a>                             (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
 
128
                                                         struct utimbuf *utb);
128
129
</pre>
129
130
</div>
130
131
<div class="refsect1" lang="en">
131
 
<a name="id2864430"></a><h2>Description</h2>
 
132
<a name="glib-File-Utilities.description"></a><h2>Description</h2>
132
133
<p>
133
 
There is a group of functions which wrap the common POSIX functions 
134
 
dealing with filenames (<a class="link" href="glib-File-Utilities.html#g-open"><code class="function">g_open()</code></a>, <a class="link" href="glib-File-Utilities.html#g-rename"><code class="function">g_rename()</code></a>, <a class="link" href="glib-File-Utilities.html#g-mkdir"><code class="function">g_mkdir()</code></a>, <a class="link" href="glib-File-Utilities.html#g-stat"><code class="function">g_stat()</code></a>, 
135
 
<a class="link" href="glib-File-Utilities.html#g-unlink"><code class="function">g_unlink()</code></a>, <a class="link" href="glib-File-Utilities.html#g-remove"><code class="function">g_remove()</code></a>, <a class="link" href="glib-File-Utilities.html#g-fopen"><code class="function">g_fopen()</code></a>, <a class="link" href="glib-File-Utilities.html#g-freopen"><code class="function">g_freopen()</code></a>). The point of these 
136
 
wrappers is to make it possible to handle file names with any Unicode 
137
 
characters in them on Windows without having to use ifdefs and the 
 
134
There is a group of functions which wrap the common POSIX functions
 
135
dealing with filenames (<a class="link" href="glib-File-Utilities.html#g-open" title="g_open ()"><code class="function">g_open()</code></a>, <a class="link" href="glib-File-Utilities.html#g-rename" title="g_rename ()"><code class="function">g_rename()</code></a>, <a class="link" href="glib-File-Utilities.html#g-mkdir" title="g_mkdir ()"><code class="function">g_mkdir()</code></a>, <a class="link" href="glib-File-Utilities.html#g-stat" title="g_stat ()"><code class="function">g_stat()</code></a>,
 
136
<a class="link" href="glib-File-Utilities.html#g-unlink" title="g_unlink ()"><code class="function">g_unlink()</code></a>, <a class="link" href="glib-File-Utilities.html#g-remove" title="g_remove ()"><code class="function">g_remove()</code></a>, <a class="link" href="glib-File-Utilities.html#g-fopen" title="g_fopen ()"><code class="function">g_fopen()</code></a>, <a class="link" href="glib-File-Utilities.html#g-freopen" title="g_freopen ()"><code class="function">g_freopen()</code></a>). The point of these
 
137
wrappers is to make it possible to handle file names with any Unicode
 
138
characters in them on Windows without having to use ifdefs and the
138
139
wide character API in the application code.
139
140
</p>
140
141
<p>
141
142
The pathname argument should be in the GLib file name encoding. On
142
143
POSIX this is the actual on-disk encoding which might correspond to
143
 
the locale settings of the process (or the 
 
144
the locale settings of the process (or the
144
145
<code class="envar">G_FILENAME_ENCODING</code> environment variable), or not.
145
146
</p>
146
147
<p>
152
153
</p>
153
154
<p>
154
155
Another group of functions allows to open and read directories
155
 
in the GLib file name encoding. These are <a class="link" href="glib-File-Utilities.html#g-dir-open"><code class="function">g_dir_open()</code></a>, 
156
 
<a class="link" href="glib-File-Utilities.html#g-dir-read-name"><code class="function">g_dir_read_name()</code></a>, <a class="link" href="glib-File-Utilities.html#g-dir-rewind"><code class="function">g_dir_rewind()</code></a>, <a class="link" href="glib-File-Utilities.html#g-dir-close"><code class="function">g_dir_close()</code></a>.
 
156
in the GLib file name encoding. These are <a class="link" href="glib-File-Utilities.html#g-dir-open" title="g_dir_open ()"><code class="function">g_dir_open()</code></a>,
 
157
<a class="link" href="glib-File-Utilities.html#g-dir-read-name" title="g_dir_read_name ()"><code class="function">g_dir_read_name()</code></a>, <a class="link" href="glib-File-Utilities.html#g-dir-rewind" title="g_dir_rewind ()"><code class="function">g_dir_rewind()</code></a>, <a class="link" href="glib-File-Utilities.html#g-dir-close" title="g_dir_close ()"><code class="function">g_dir_close()</code></a>.
157
158
</p>
158
159
</div>
159
160
<div class="refsect1" lang="en">
160
 
<a name="id3165805"></a><h2>Details</h2>
 
161
<a name="glib-File-Utilities.details"></a><h2>Details</h2>
161
162
<div class="refsect2" lang="en">
162
 
<a name="id3165816"></a><h3>
163
 
<a name="GFileError"></a>enum GFileError</h3>
164
 
<a class="indexterm" name="id3165827"></a><pre class="programlisting">typedef enum
 
163
<a name="GFileError"></a><h3>enum GFileError</h3>
 
164
<pre class="programlisting">typedef enum
165
165
{
166
166
  G_FILE_ERROR_EXIST,
167
167
  G_FILE_ERROR_ISDIR,
192
192
</pre>
193
193
<p>
194
194
Values corresponding to <code class="literal">errno</code> codes returned from file operations
195
 
on UNIX. Unlike <code class="literal">errno</code> codes, <a class="link" href="glib-File-Utilities.html#GFileError"><span class="type">GFileError</span></a> values are available on 
 
195
on UNIX. Unlike <code class="literal">errno</code> codes, <a class="link" href="glib-File-Utilities.html#GFileError" title="enum GFileError"><span class="type">GFileError</span></a> values are available on
196
196
all systems, even Windows. The exact meaning of each code depends on what
197
197
sort of file operation you were performing; the UNIX documentation
198
 
gives more details. The following error code descriptions come 
 
198
gives more details. The following error code descriptions come
199
199
from the GNU C Library manual, and are under the copyright
200
200
of that manual.
201
201
</p>
209
209
<col align="left" valign="top">
210
210
<tbody>
211
211
<tr>
212
 
<td><p><span class="term"><a name="G-FILE-ERROR-EXIST:CAPS"></a><code class="literal">G_FILE_ERROR_EXIST</code></span></p></td>
 
212
<td><p><a name="G-FILE-ERROR-EXIST--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_EXIST</code></span></p></td>
213
213
<td>Operation not permitted; only the owner of the
214
214
     file (or other resource) or processes with special privileges can
215
215
     perform the operation.
216
216
</td>
217
217
</tr>
218
218
<tr>
219
 
<td><p><span class="term"><a name="G-FILE-ERROR-ISDIR:CAPS"></a><code class="literal">G_FILE_ERROR_ISDIR</code></span></p></td>
 
219
<td><p><a name="G-FILE-ERROR-ISDIR--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_ISDIR</code></span></p></td>
220
220
<td>File is a directory; you cannot open a directory
221
221
     for writing, or create or remove hard links to it.
222
222
</td>
223
223
</tr>
224
224
<tr>
225
 
<td><p><span class="term"><a name="G-FILE-ERROR-ACCES:CAPS"></a><code class="literal">G_FILE_ERROR_ACCES</code></span></p></td>
 
225
<td><p><a name="G-FILE-ERROR-ACCES--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_ACCES</code></span></p></td>
226
226
<td>Permission denied; the file permissions do not
227
227
     allow the attempted operation.
228
228
</td>
229
229
</tr>
230
230
<tr>
231
 
<td><p><span class="term"><a name="G-FILE-ERROR-NAMETOOLONG:CAPS"></a><code class="literal">G_FILE_ERROR_NAMETOOLONG</code></span></p></td>
 
231
<td><p><a name="G-FILE-ERROR-NAMETOOLONG--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_NAMETOOLONG</code></span></p></td>
232
232
<td>Filename too long.
233
233
</td>
234
234
</tr>
235
235
<tr>
236
 
<td><p><span class="term"><a name="G-FILE-ERROR-NOENT:CAPS"></a><code class="literal">G_FILE_ERROR_NOENT</code></span></p></td>
 
236
<td><p><a name="G-FILE-ERROR-NOENT--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_NOENT</code></span></p></td>
237
237
<td>No such file or directory.  This is a "file
238
238
     doesn't exist" error for ordinary files that are referenced in
239
239
     contexts where they are expected to already exist.
240
240
</td>
241
241
</tr>
242
242
<tr>
243
 
<td><p><span class="term"><a name="G-FILE-ERROR-NOTDIR:CAPS"></a><code class="literal">G_FILE_ERROR_NOTDIR</code></span></p></td>
 
243
<td><p><a name="G-FILE-ERROR-NOTDIR--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_NOTDIR</code></span></p></td>
244
244
<td>A file that isn't a directory was specified when
245
245
     a directory is required.
246
246
</td>
247
247
</tr>
248
248
<tr>
249
 
<td><p><span class="term"><a name="G-FILE-ERROR-NXIO:CAPS"></a><code class="literal">G_FILE_ERROR_NXIO</code></span></p></td>
 
249
<td><p><a name="G-FILE-ERROR-NXIO--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_NXIO</code></span></p></td>
250
250
<td>No such device or address.  The system tried to
251
251
     use the device represented by a file you specified, and it
252
252
     couldn't find the device.  This can mean that the device file was
255
255
</td>
256
256
</tr>
257
257
<tr>
258
 
<td><p><span class="term"><a name="G-FILE-ERROR-NODEV:CAPS"></a><code class="literal">G_FILE_ERROR_NODEV</code></span></p></td>
 
258
<td><p><a name="G-FILE-ERROR-NODEV--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_NODEV</code></span></p></td>
259
259
<td>This file is of a type that doesn't support
260
260
     mapping.
261
261
</td>
262
262
</tr>
263
263
<tr>
264
 
<td><p><span class="term"><a name="G-FILE-ERROR-ROFS:CAPS"></a><code class="literal">G_FILE_ERROR_ROFS</code></span></p></td>
 
264
<td><p><a name="G-FILE-ERROR-ROFS--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_ROFS</code></span></p></td>
265
265
<td>The directory containing the new link can't be
266
266
          modified because it's on a read-only file system.
267
267
</td>
268
268
</tr>
269
269
<tr>
270
 
<td><p><span class="term"><a name="G-FILE-ERROR-TXTBSY:CAPS"></a><code class="literal">G_FILE_ERROR_TXTBSY</code></span></p></td>
 
270
<td><p><a name="G-FILE-ERROR-TXTBSY--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_TXTBSY</code></span></p></td>
271
271
<td>Text file busy.
272
272
</td>
273
273
</tr>
274
274
<tr>
275
 
<td><p><span class="term"><a name="G-FILE-ERROR-FAULT:CAPS"></a><code class="literal">G_FILE_ERROR_FAULT</code></span></p></td>
 
275
<td><p><a name="G-FILE-ERROR-FAULT--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_FAULT</code></span></p></td>
276
276
<td>You passed in a pointer to bad memory.
277
277
  (GLib won't reliably return this, don't pass in pointers to bad
278
278
  memory.)
279
279
</td>
280
280
</tr>
281
281
<tr>
282
 
<td><p><span class="term"><a name="G-FILE-ERROR-LOOP:CAPS"></a><code class="literal">G_FILE_ERROR_LOOP</code></span></p></td>
 
282
<td><p><a name="G-FILE-ERROR-LOOP--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_LOOP</code></span></p></td>
283
283
<td>Too many levels of symbolic links were encountered
284
284
  in looking up a file name.  This often indicates a cycle of symbolic
285
285
  links.
286
286
</td>
287
287
</tr>
288
288
<tr>
289
 
<td><p><span class="term"><a name="G-FILE-ERROR-NOSPC:CAPS"></a><code class="literal">G_FILE_ERROR_NOSPC</code></span></p></td>
 
289
<td><p><a name="G-FILE-ERROR-NOSPC--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_NOSPC</code></span></p></td>
290
290
<td>No space left on device; write operation on a
291
291
  file failed because the disk is full.
292
292
</td>
293
293
</tr>
294
294
<tr>
295
 
<td><p><span class="term"><a name="G-FILE-ERROR-NOMEM:CAPS"></a><code class="literal">G_FILE_ERROR_NOMEM</code></span></p></td>
 
295
<td><p><a name="G-FILE-ERROR-NOMEM--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_NOMEM</code></span></p></td>
296
296
<td>No memory available.  The system cannot allocate
297
297
     more virtual memory because its capacity is full.
298
298
</td>
299
299
</tr>
300
300
<tr>
301
 
<td><p><span class="term"><a name="G-FILE-ERROR-MFILE:CAPS"></a><code class="literal">G_FILE_ERROR_MFILE</code></span></p></td>
 
301
<td><p><a name="G-FILE-ERROR-MFILE--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_MFILE</code></span></p></td>
302
302
<td>The current process has too many files open and
303
303
     can't open any more.  Duplicate descriptors do count toward this
304
304
     limit.
305
305
</td>
306
306
</tr>
307
307
<tr>
308
 
<td><p><span class="term"><a name="G-FILE-ERROR-NFILE:CAPS"></a><code class="literal">G_FILE_ERROR_NFILE</code></span></p></td>
 
308
<td><p><a name="G-FILE-ERROR-NFILE--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_NFILE</code></span></p></td>
309
309
<td>There are too many distinct file openings in the
310
310
     entire system.
311
311
</td>
312
312
</tr>
313
313
<tr>
314
 
<td><p><span class="term"><a name="G-FILE-ERROR-BADF:CAPS"></a><code class="literal">G_FILE_ERROR_BADF</code></span></p></td>
 
314
<td><p><a name="G-FILE-ERROR-BADF--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_BADF</code></span></p></td>
315
315
<td>Bad file descriptor; for example, I/O on a
316
316
     descriptor that has been closed or reading from a descriptor open
317
317
     only for writing (or vice versa).
318
318
</td>
319
319
</tr>
320
320
<tr>
321
 
<td><p><span class="term"><a name="G-FILE-ERROR-INVAL:CAPS"></a><code class="literal">G_FILE_ERROR_INVAL</code></span></p></td>
 
321
<td><p><a name="G-FILE-ERROR-INVAL--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_INVAL</code></span></p></td>
322
322
<td>Invalid argument.  This is used to indicate
323
323
     various kinds of problems with passing the wrong argument to a
324
324
     library function.
325
325
</td>
326
326
</tr>
327
327
<tr>
328
 
<td><p><span class="term"><a name="G-FILE-ERROR-PIPE:CAPS"></a><code class="literal">G_FILE_ERROR_PIPE</code></span></p></td>
 
328
<td><p><a name="G-FILE-ERROR-PIPE--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_PIPE</code></span></p></td>
329
329
<td>Broken pipe; there is no process reading from the
330
330
     other end of a pipe.  Every library function that returns this
331
331
     error code also generates a `SIGPIPE' signal; this signal
335
335
</td>
336
336
</tr>
337
337
<tr>
338
 
<td><p><span class="term"><a name="G-FILE-ERROR-AGAIN:CAPS"></a><code class="literal">G_FILE_ERROR_AGAIN</code></span></p></td>
 
338
<td><p><a name="G-FILE-ERROR-AGAIN--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_AGAIN</code></span></p></td>
339
339
<td>Resource temporarily unavailable; the call might
340
340
     work if you try again later.
341
341
</td>
342
342
</tr>
343
343
<tr>
344
 
<td><p><span class="term"><a name="G-FILE-ERROR-INTR:CAPS"></a><code class="literal">G_FILE_ERROR_INTR</code></span></p></td>
 
344
<td><p><a name="G-FILE-ERROR-INTR--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_INTR</code></span></p></td>
345
345
<td>Interrupted function call; an asynchronous signal
346
346
     occurred and prevented completion of the call.  When this
347
347
     happens, you should try the call again.
348
348
</td>
349
349
</tr>
350
350
<tr>
351
 
<td><p><span class="term"><a name="G-FILE-ERROR-IO:CAPS"></a><code class="literal">G_FILE_ERROR_IO</code></span></p></td>
 
351
<td><p><a name="G-FILE-ERROR-IO--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_IO</code></span></p></td>
352
352
<td>Input/output error; usually used for physical read
353
353
    or write errors. i.e. the disk or other physical device hardware
354
354
    is returning errors.
355
355
</td>
356
356
</tr>
357
357
<tr>
358
 
<td><p><span class="term"><a name="G-FILE-ERROR-PERM:CAPS"></a><code class="literal">G_FILE_ERROR_PERM</code></span></p></td>
 
358
<td><p><a name="G-FILE-ERROR-PERM--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_PERM</code></span></p></td>
359
359
<td>Operation not permitted; only the owner of the
360
360
     file (or other resource) or processes with special privileges can
361
361
     perform the operation.
362
362
</td>
363
363
</tr>
364
364
<tr>
365
 
<td><p><span class="term"><a name="G-FILE-ERROR-NOSYS:CAPS"></a><code class="literal">G_FILE_ERROR_NOSYS</code></span></p></td>
 
365
<td><p><a name="G-FILE-ERROR-NOSYS--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_NOSYS</code></span></p></td>
366
366
<td>Function not implemented; this indicates that the
367
367
    system is missing some functionality.
368
368
</td>
369
369
</tr>
370
370
<tr>
371
 
<td><p><span class="term"><a name="G-FILE-ERROR-FAILED:CAPS"></a><code class="literal">G_FILE_ERROR_FAILED</code></span></p></td>
 
371
<td><p><a name="G-FILE-ERROR-FAILED--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_FAILED</code></span></p></td>
372
372
<td>Does not correspond to a UNIX error code; this
373
 
  is the standard "failed for unspecified reason" error code present in 
374
 
  all <a class="link" href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a> error code enumerations. Returned if no specific
 
373
  is the standard "failed for unspecified reason" error code present in
 
374
  all <a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="type">GError</span></a> error code enumerations. Returned if no specific
375
375
  code applies.
376
 
 
377
376
</td>
378
377
</tr>
379
378
</tbody>
381
380
</div>
382
381
<hr>
383
382
<div class="refsect2" lang="en">
384
 
<a name="id3166425"></a><h3>
385
 
<a name="G-FILE-ERROR:CAPS"></a>G_FILE_ERROR</h3>
386
 
<a class="indexterm" name="id3166435"></a><pre class="programlisting">#define G_FILE_ERROR g_file_error_quark ()
 
383
<a name="G-FILE-ERROR--CAPS"></a><h3>G_FILE_ERROR</h3>
 
384
<pre class="programlisting">#define G_FILE_ERROR g_file_error_quark ()
387
385
</pre>
388
386
<p>
389
387
Error domain for file operations. Errors in this domain will
390
 
be from the <a class="link" href="glib-File-Utilities.html#GFileError"><span class="type">GFileError</span></a> enumeration. See <a class="link" href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for information on 
 
388
be from the <a class="link" href="glib-File-Utilities.html#GFileError" title="enum GFileError"><span class="type">GFileError</span></a> enumeration. See <a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="type">GError</span></a> for information on
391
389
error domains.
392
390
</p>
393
391
</div>
394
392
<hr>
395
393
<div class="refsect2" lang="en">
396
 
<a name="id3166464"></a><h3>
397
 
<a name="GFileTest"></a>enum GFileTest</h3>
398
 
<a class="indexterm" name="id3166475"></a><pre class="programlisting">typedef enum
 
394
<a name="GFileTest"></a><h3>enum GFileTest</h3>
 
395
<pre class="programlisting">typedef enum
399
396
{
400
397
  G_FILE_TEST_IS_REGULAR    = 1 &lt;&lt; 0,
401
398
  G_FILE_TEST_IS_SYMLINK    = 1 &lt;&lt; 1,
405
402
} GFileTest;
406
403
</pre>
407
404
<p>
408
 
A test to perform on a file using <a class="link" href="glib-File-Utilities.html#g-file-test"><code class="function">g_file_test()</code></a>.
 
405
A test to perform on a file using <a class="link" href="glib-File-Utilities.html#g-file-test" title="g_file_test ()"><code class="function">g_file_test()</code></a>.
409
406
</p>
410
407
<div class="variablelist"><table border="0">
411
408
<col align="left" valign="top">
412
409
<tbody>
413
410
<tr>
414
 
<td><p><span class="term"><a name="G-FILE-TEST-IS-REGULAR:CAPS"></a><code class="literal">G_FILE_TEST_IS_REGULAR</code></span></p></td>
415
 
<td>
416
 
<a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the file is a regular file (not a directory).
417
 
    Note that this test will also return <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the tested file is a symlink
 
411
<td><p><a name="G-FILE-TEST-IS-REGULAR--CAPS"></a><span class="term"><code class="literal">G_FILE_TEST_IS_REGULAR</code></span></p></td>
 
412
<td>%TRUE if the file is a regular file (not a directory).
 
413
    Note that this test will also return <a class="link" href="glib-Standard-Macros.html#TRUE--CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the tested file is a symlink
418
414
    to a regular file.
419
415
</td>
420
416
</tr>
421
417
<tr>
422
 
<td><p><span class="term"><a name="G-FILE-TEST-IS-SYMLINK:CAPS"></a><code class="literal">G_FILE_TEST_IS_SYMLINK</code></span></p></td>
423
 
<td>
424
 
<a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the file is a symlink.
425
 
</td>
426
 
</tr>
427
 
<tr>
428
 
<td><p><span class="term"><a name="G-FILE-TEST-IS-DIR:CAPS"></a><code class="literal">G_FILE_TEST_IS_DIR</code></span></p></td>
429
 
<td>
430
 
<a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the file is a directory.
431
 
</td>
432
 
</tr>
433
 
<tr>
434
 
<td><p><span class="term"><a name="G-FILE-TEST-IS-EXECUTABLE:CAPS"></a><code class="literal">G_FILE_TEST_IS_EXECUTABLE</code></span></p></td>
435
 
<td>
436
 
<a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the file is executable.
437
 
</td>
438
 
</tr>
439
 
<tr>
440
 
<td><p><span class="term"><a name="G-FILE-TEST-EXISTS:CAPS"></a><code class="literal">G_FILE_TEST_EXISTS</code></span></p></td>
441
 
<td>
442
 
<a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the file exists. 
 
418
<td><p><a name="G-FILE-TEST-IS-SYMLINK--CAPS"></a><span class="term"><code class="literal">G_FILE_TEST_IS_SYMLINK</code></span></p></td>
 
419
<td>%TRUE if the file is a symlink.
 
420
</td>
 
421
</tr>
 
422
<tr>
 
423
<td><p><a name="G-FILE-TEST-IS-DIR--CAPS"></a><span class="term"><code class="literal">G_FILE_TEST_IS_DIR</code></span></p></td>
 
424
<td>%TRUE if the file is a directory.
 
425
</td>
 
426
</tr>
 
427
<tr>
 
428
<td><p><a name="G-FILE-TEST-IS-EXECUTABLE--CAPS"></a><span class="term"><code class="literal">G_FILE_TEST_IS_EXECUTABLE</code></span></p></td>
 
429
<td>%TRUE if the file is executable.
 
430
</td>
 
431
</tr>
 
432
<tr>
 
433
<td><p><a name="G-FILE-TEST-EXISTS--CAPS"></a><span class="term"><code class="literal">G_FILE_TEST_EXISTS</code></span></p></td>
 
434
<td>%TRUE if the file exists. 
443
435
    It may or may not be a regular file.
444
 
 
445
436
</td>
446
437
</tr>
447
438
</tbody>
449
440
</div>
450
441
<hr>
451
442
<div class="refsect2" lang="en">
452
 
<a name="id3166650"></a><h3>
453
 
<a name="g-file-error-from-errno"></a>g_file_error_from_errno ()</h3>
454
 
<a class="indexterm" name="id3166660"></a><pre class="programlisting"><a class="link" href="glib-File-Utilities.html#GFileError">GFileError</a>          g_file_error_from_errno             (<a class="link" href="glib-Basic-Types.html#gint">gint</a> err_no);</pre>
 
443
<a name="g-file-error-from-errno"></a><h3>g_file_error_from_errno ()</h3>
 
444
<pre class="programlisting"><a class="link" href="glib-File-Utilities.html#GFileError" title="enum GFileError">GFileError</a>          g_file_error_from_errno             (<a class="link" href="glib-Basic-Types.html#gint" title="gint">gint</a> err_no);</pre>
455
445
<p>
456
 
Gets a <a class="link" 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>.
 
446
Gets a <a class="link" href="glib-File-Utilities.html#GFileError" title="enum GFileError"><span class="type">GFileError</span></a> constant based on the passed-in <em class="parameter"><code>errno</code></em>.
457
447
For example, if you pass in <code class="literal">EEXIST</code> this function returns
458
 
<a class="link" 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
459
 
assume that all <a class="link" href="glib-File-Utilities.html#GFileError"><span class="type">GFileError</span></a> values will exist.
 
448
<a class="link" 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
 
449
assume that all <a class="link" href="glib-File-Utilities.html#GFileError" title="enum GFileError"><span class="type">GFileError</span></a> values will exist.
460
450
</p>
461
451
<p>
462
 
Normally a <a class="link" href="glib-File-Utilities.html#GFileError"><span class="type">GFileError</span></a> value goes into a <a class="link" href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a> returned
 
452
Normally a <a class="link" href="glib-File-Utilities.html#GFileError" title="enum GFileError"><span class="type">GFileError</span></a> value goes into a <a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="type">GError</span></a> returned
463
453
from a function that manipulates files. So you would use
464
 
<a class="link" href="glib-File-Utilities.html#g-file-error-from-errno"><code class="function">g_file_error_from_errno()</code></a> when constructing a <a class="link" href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a>.</p>
 
454
<a class="link" href="glib-File-Utilities.html#g-file-error-from-errno" title="g_file_error_from_errno ()"><code class="function">g_file_error_from_errno()</code></a> when constructing a <a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="type">GError</span></a>.</p>
465
455
<p>
466
 
 
467
456
</p>
468
457
<div class="variablelist"><table border="0">
469
458
<col align="left" valign="top">
470
459
<tbody>
471
460
<tr>
472
 
<td><p><span class="term"><em class="parameter"><code>err_no</code></em>&#160;:</span></p></td>
 
461
<td><p><span class="term"><em class="parameter"><code>err_no</code></em> :</span></p></td>
473
462
<td> an "errno" value
474
463
</td>
475
464
</tr>
476
465
<tr>
477
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
478
 
<td> <a class="link" href="glib-File-Utilities.html#GFileError"><span class="type">GFileError</span></a> corresponding to the given <em class="parameter"><code>errno</code></em>
 
466
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
 
467
<td> <a class="link" href="glib-File-Utilities.html#GFileError" title="enum GFileError"><span class="type">GFileError</span></a> corresponding to the given <em class="parameter"><code>errno</code></em>
479
468
</td>
480
469
</tr>
481
470
</tbody>
483
472
</div>
484
473
<hr>
485
474
<div class="refsect2" lang="en">
486
 
<a name="id3166797"></a><h3>
487
 
<a name="g-file-get-contents"></a>g_file_get_contents ()</h3>
488
 
<a class="indexterm" name="id3166808"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a>            g_file_get_contents                 (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename,
489
 
                                                         <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> **contents,
490
 
                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> *length,
491
 
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);</pre>
 
475
<a name="g-file-get-contents"></a><h3>g_file_get_contents ()</h3>
 
476
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean">gboolean</a>            g_file_get_contents                 (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
 
477
                                                         <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> **contents,
 
478
                                                         <a class="link" href="glib-Basic-Types.html#gsize" title="gsize">gsize</a> *length,
 
479
                                                         <a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);</pre>
492
480
<p>
493
481
Reads an entire file into allocated memory, with good error
494
482
checking. 
495
483
</p>
496
484
<p>
497
 
If the call was successful, it returns <a class="link" 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 
 
485
If the call was successful, it returns <a class="link" href="glib-Standard-Macros.html#TRUE--CAPS" title="TRUE"><code class="literal">TRUE</code></a> and sets <em class="parameter"><code>contents</code></em> to the file 
498
486
contents and <em class="parameter"><code>length</code></em> to the length of the file contents in bytes. The string 
499
487
stored in <em class="parameter"><code>contents</code></em> will be nul-terminated, so for text files you can pass 
500
 
<a class="link" 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 
501
 
<a class="link" 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 class="link" href="glib-File-Utilities.html#G-FILE-ERROR:CAPS"><span class="type">G_FILE_ERROR</span></a>. Possible error  
502
 
codes are those in the <a class="link" href="glib-File-Utilities.html#GFileError"><span class="type">GFileError</span></a> enumeration. In the error case, 
503
 
<em class="parameter"><code>contents</code></em> is set to <a class="link" 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>
 
488
<a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a> for the <em class="parameter"><code>length</code></em> argument. If the call was not successful, it returns 
 
489
<a class="link" href="glib-Standard-Macros.html#FALSE--CAPS" title="FALSE"><code class="literal">FALSE</code></a> and sets <em class="parameter"><code>error</code></em>. The error domain is <a class="link" href="glib-File-Utilities.html#G-FILE-ERROR--CAPS" title="G_FILE_ERROR"><span class="type">G_FILE_ERROR</span></a>. Possible error  
 
490
codes are those in the <a class="link" href="glib-File-Utilities.html#GFileError" title="enum GFileError"><span class="type">GFileError</span></a> enumeration. In the error case, 
 
491
<em class="parameter"><code>contents</code></em> is set to <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a> and <em class="parameter"><code>length</code></em> is set to zero.</p>
504
492
<p>
505
 
 
506
493
</p>
507
494
<div class="variablelist"><table border="0">
508
495
<col align="left" valign="top">
509
496
<tbody>
510
497
<tr>
511
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></p></td>
 
498
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
512
499
<td> name of a file to read contents from, in the GLib file name encoding
513
500
</td>
514
501
</tr>
515
502
<tr>
516
 
<td><p><span class="term"><em class="parameter"><code>contents</code></em>&#160;:</span></p></td>
 
503
<td><p><span class="term"><em class="parameter"><code>contents</code></em> :</span></p></td>
517
504
<td> location to store an allocated string
518
505
</td>
519
506
</tr>
520
507
<tr>
521
 
<td><p><span class="term"><em class="parameter"><code>length</code></em>&#160;:</span></p></td>
522
 
<td> location to store length in bytes of the contents, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
523
 
</td>
524
 
</tr>
525
 
<tr>
526
 
<td><p><span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></p></td>
527
 
<td> return location for a <a class="link" href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
528
 
</td>
529
 
</tr>
530
 
<tr>
531
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
532
 
<td> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> on success, <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if an error occurred
 
508
<td><p><span class="term"><em class="parameter"><code>length</code></em> :</span></p></td>
 
509
<td> location to store length in bytes of the contents, or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>
 
510
</td>
 
511
</tr>
 
512
<tr>
 
513
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
 
514
<td> return location for a <a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="type">GError</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>
 
515
</td>
 
516
</tr>
 
517
<tr>
 
518
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
 
519
<td> <a class="link" href="glib-Standard-Macros.html#TRUE--CAPS" title="TRUE"><code class="literal">TRUE</code></a> on success, <a class="link" href="glib-Standard-Macros.html#FALSE--CAPS" title="FALSE"><code class="literal">FALSE</code></a> if an error occurred
533
520
</td>
534
521
</tr>
535
522
</tbody>
537
524
</div>
538
525
<hr>
539
526
<div class="refsect2" lang="en">
540
 
<a name="id3167053"></a><h3>
541
 
<a name="g-file-set-contents"></a>g_file_set_contents ()</h3>
542
 
<a class="indexterm" name="id3167066"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a>            g_file_set_contents                 (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename,
543
 
                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *contents,
544
 
                                                         <a class="link" href="glib-Basic-Types.html#gssize">gssize</a> length,
545
 
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);</pre>
 
527
<a name="g-file-set-contents"></a><h3>g_file_set_contents ()</h3>
 
528
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean">gboolean</a>            g_file_set_contents                 (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
 
529
                                                         const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *contents,
 
530
                                                         <a class="link" href="glib-Basic-Types.html#gssize" title="gssize">gssize</a> length,
 
531
                                                         <a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);</pre>
546
532
<p>
547
533
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.
548
534
If a file called <em class="parameter"><code>filename</code></em> already exists it will be overwritten.
572
558
<p>
573
559
</p>
574
560
<p>
575
 
If the call was sucessful, it returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>. If the call was not successful,
576
 
it returns <a class="link" 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 class="link" href="glib-File-Utilities.html#G-FILE-ERROR:CAPS"><span class="type">G_FILE_ERROR</span></a>.
577
 
Possible error codes are those in the <a class="link" href="glib-File-Utilities.html#GFileError"><span class="type">GFileError</span></a> enumeration.</p>
 
561
If the call was sucessful, it returns <a class="link" href="glib-Standard-Macros.html#TRUE--CAPS" title="TRUE"><code class="literal">TRUE</code></a>. If the call was not successful,
 
562
it returns <a class="link" href="glib-Standard-Macros.html#FALSE--CAPS" title="FALSE"><code class="literal">FALSE</code></a> and sets <em class="parameter"><code>error</code></em>. The error domain is <a class="link" href="glib-File-Utilities.html#G-FILE-ERROR--CAPS" title="G_FILE_ERROR"><span class="type">G_FILE_ERROR</span></a>.
 
563
Possible error codes are those in the <a class="link" href="glib-File-Utilities.html#GFileError" title="enum GFileError"><span class="type">GFileError</span></a> enumeration.</p>
578
564
<p>
579
 
 
580
565
</p>
581
566
<div class="variablelist"><table border="0">
582
567
<col align="left" valign="top">
583
568
<tbody>
584
569
<tr>
585
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></p></td>
 
570
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
586
571
<td> name of a file to write <em class="parameter"><code>contents</code></em> to, in the GLib file name
587
572
  encoding
588
573
</td>
589
574
</tr>
590
575
<tr>
591
 
<td><p><span class="term"><em class="parameter"><code>contents</code></em>&#160;:</span></p></td>
 
576
<td><p><span class="term"><em class="parameter"><code>contents</code></em> :</span></p></td>
592
577
<td> string to write to the file
593
578
</td>
594
579
</tr>
595
580
<tr>
596
 
<td><p><span class="term"><em class="parameter"><code>length</code></em>&#160;:</span></p></td>
 
581
<td><p><span class="term"><em class="parameter"><code>length</code></em> :</span></p></td>
597
582
<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
598
583
</td>
599
584
</tr>
600
585
<tr>
601
 
<td><p><span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></p></td>
602
 
<td> return location for a <a class="link" href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
 
586
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
 
587
<td> return location for a <a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="type">GError</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>
603
588
</td>
604
589
</tr>
605
590
<tr>
606
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
607
 
<td> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> on success, <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if an error occurred
 
591
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
 
592
<td> <a class="link" href="glib-Standard-Macros.html#TRUE--CAPS" title="TRUE"><code class="literal">TRUE</code></a> on success, <a class="link" href="glib-Standard-Macros.html#FALSE--CAPS" title="FALSE"><code class="literal">FALSE</code></a> if an error occurred
608
593
 
609
594
</td>
610
595
</tr>
611
596
</tbody>
612
597
</table></div>
613
 
<p class="since">Since  2.8
614
 
</p>
 
598
<p class="since">Since 2.8</p>
615
599
</div>
616
600
<hr>
617
601
<div class="refsect2" lang="en">
618
 
<a name="id3167339"></a><h3>
619
 
<a name="g-file-test"></a>g_file_test ()</h3>
620
 
<a class="indexterm" name="id3167350"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a>            g_file_test                         (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename,
621
 
                                                         <a class="link" href="glib-File-Utilities.html#GFileTest">GFileTest</a> test);</pre>
 
602
<a name="g-file-test"></a><h3>g_file_test ()</h3>
 
603
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean">gboolean</a>            g_file_test                         (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
 
604
                                                         <a class="link" href="glib-File-Utilities.html#GFileTest" title="enum GFileTest">GFileTest</a> test);</pre>
622
605
<p>
623
 
Returns <a class="link" 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
624
 
<a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>. For example, <code class="literal">(G_FILE_TEST_EXISTS | 
625
 
G_FILE_TEST_IS_DIR)</code> will return <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the file exists; 
 
606
Returns <a class="link" href="glib-Standard-Macros.html#TRUE--CAPS" title="TRUE"><code class="literal">TRUE</code></a> if any of the tests in the bitfield <em class="parameter"><code>test</code></em> are
 
607
<a class="link" href="glib-Standard-Macros.html#TRUE--CAPS" title="TRUE"><code class="literal">TRUE</code></a>. For example, <code class="literal">(G_FILE_TEST_EXISTS | 
 
608
G_FILE_TEST_IS_DIR)</code> will return <a class="link" href="glib-Standard-Macros.html#TRUE--CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the file exists; 
626
609
the check whether it's a directory doesn't matter since the existence 
627
 
test is <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>. With the current set of available tests, there's no point
 
610
test is <a class="link" href="glib-Standard-Macros.html#TRUE--CAPS" title="TRUE"><code class="literal">TRUE</code></a>. With the current set of available tests, there's no point
628
611
passing in more than one test at a time.
629
612
</p>
630
613
<p>
631
 
Apart from <a class="link" 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,
632
 
so for a symbolic link to a regular file <a class="link" href="glib-File-Utilities.html#g-file-test"><code class="function">g_file_test()</code></a> will return
633
 
<a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> for both <a class="link" href="glib-File-Utilities.html#G-FILE-TEST-IS-SYMLINK:CAPS"><code class="literal">G_FILE_TEST_IS_SYMLINK</code></a> and <a class="link" href="glib-File-Utilities.html#G-FILE-TEST-IS-REGULAR:CAPS"><code class="literal">G_FILE_TEST_IS_REGULAR</code></a>.
634
 
</p>
635
 
<p>
636
 
Note, that for a dangling symbolic link <a class="link" href="glib-File-Utilities.html#g-file-test"><code class="function">g_file_test()</code></a> will return
637
 
<a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> for <a class="link" href="glib-File-Utilities.html#G-FILE-TEST-IS-SYMLINK:CAPS"><code class="literal">G_FILE_TEST_IS_SYMLINK</code></a> and <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> for all other flags.
638
 
</p>
639
 
<p>
640
 
You should never use <a class="link" href="glib-File-Utilities.html#g-file-test"><code class="function">g_file_test()</code></a> to test whether it is safe
 
614
Apart from <a class="link" 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,
 
615
so for a symbolic link to a regular file <a class="link" href="glib-File-Utilities.html#g-file-test" title="g_file_test ()"><code class="function">g_file_test()</code></a> will return
 
616
<a class="link" href="glib-Standard-Macros.html#TRUE--CAPS" title="TRUE"><code class="literal">TRUE</code></a> for both <a class="link" href="glib-File-Utilities.html#G-FILE-TEST-IS-SYMLINK--CAPS"><code class="literal">G_FILE_TEST_IS_SYMLINK</code></a> and <a class="link" href="glib-File-Utilities.html#G-FILE-TEST-IS-REGULAR--CAPS"><code class="literal">G_FILE_TEST_IS_REGULAR</code></a>.
 
617
</p>
 
618
<p>
 
619
Note, that for a dangling symbolic link <a class="link" href="glib-File-Utilities.html#g-file-test" title="g_file_test ()"><code class="function">g_file_test()</code></a> will return
 
620
<a class="link" href="glib-Standard-Macros.html#TRUE--CAPS" title="TRUE"><code class="literal">TRUE</code></a> for <a class="link" href="glib-File-Utilities.html#G-FILE-TEST-IS-SYMLINK--CAPS"><code class="literal">G_FILE_TEST_IS_SYMLINK</code></a> and <a class="link" href="glib-Standard-Macros.html#FALSE--CAPS" title="FALSE"><code class="literal">FALSE</code></a> for all other flags.
 
621
</p>
 
622
<p>
 
623
You should never use <a class="link" href="glib-File-Utilities.html#g-file-test" title="g_file_test ()"><code class="function">g_file_test()</code></a> to test whether it is safe
641
624
to perform an operation, because there is always the possibility
642
625
of the condition changing before you actually perform the operation.
643
 
For example, you might think you could use <a class="link" href="glib-File-Utilities.html#G-FILE-TEST-IS-SYMLINK:CAPS"><code class="literal">G_FILE_TEST_IS_SYMLINK</code></a>
 
626
For example, you might think you could use <a class="link" href="glib-File-Utilities.html#G-FILE-TEST-IS-SYMLINK--CAPS"><code class="literal">G_FILE_TEST_IS_SYMLINK</code></a>
644
627
to know whether it is safe to write to a file without being
645
628
tricked into writing into a different location. It doesn't work!
646
629
</p>
655
638
<p>
656
639
</p>
657
640
<p>
658
 
Another thing to note is that <a class="link" href="glib-File-Utilities.html#G-FILE-TEST-EXISTS:CAPS"><code class="literal">G_FILE_TEST_EXISTS</code></a> and
659
 
<a class="link" 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>
 
641
Another thing to note is that <a class="link" href="glib-File-Utilities.html#G-FILE-TEST-EXISTS--CAPS"><code class="literal">G_FILE_TEST_EXISTS</code></a> and
 
642
<a class="link" 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>
660
643
system call. This usually doesn't matter, but if your program
661
644
is setuid or setgid it means that these tests will give you
662
645
the answer for the real user ID and group ID, rather than the
664
647
</p>
665
648
<p>
666
649
On Windows, there are no symlinks, so testing for
667
 
<a class="link" 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 class="link" href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>. Testing for
668
 
<a class="link" 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
 
650
<a class="link" 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 class="link" href="glib-Standard-Macros.html#FALSE--CAPS" title="FALSE"><code class="literal">FALSE</code></a>. Testing for
 
651
<a class="link" 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
669
652
its name indicates that it is executable, checking for well-known
670
653
extensions and those listed in the <code class="literal">PATHEXT</code> environment variable.</p>
671
654
<p>
672
 
 
673
655
</p>
674
656
<div class="variablelist"><table border="0">
675
657
<col align="left" valign="top">
676
658
<tbody>
677
659
<tr>
678
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></p></td>
 
660
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
679
661
<td> a filename to test in the GLib file name encoding
680
662
</td>
681
663
</tr>
682
664
<tr>
683
 
<td><p><span class="term"><em class="parameter"><code>test</code></em>&#160;:</span></p></td>
684
 
<td> bitfield of <a class="link" href="glib-File-Utilities.html#GFileTest"><span class="type">GFileTest</span></a> flags
 
665
<td><p><span class="term"><em class="parameter"><code>test</code></em> :</span></p></td>
 
666
<td> bitfield of <a class="link" href="glib-File-Utilities.html#GFileTest" title="enum GFileTest"><span class="type">GFileTest</span></a> flags
685
667
</td>
686
668
</tr>
687
669
<tr>
688
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
689
 
<td> whether a test was <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>
 
670
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
 
671
<td> whether a test was <a class="link" href="glib-Standard-Macros.html#TRUE--CAPS" title="TRUE"><code class="literal">TRUE</code></a>
690
672
</td>
691
673
</tr>
692
674
</tbody>
694
676
</div>
695
677
<hr>
696
678
<div class="refsect2" lang="en">
697
 
<a name="id3167701"></a><h3>
698
 
<a name="g-mkstemp"></a>g_mkstemp ()</h3>
699
 
<a class="indexterm" name="id3167713"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint">gint</a>                g_mkstemp                           (<a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *tmpl);</pre>
 
679
<a name="g-mkstemp"></a><h3>g_mkstemp ()</h3>
 
680
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint">gint</a>                g_mkstemp                           (<a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *tmpl);</pre>
700
681
<p>
701
682
Opens a temporary file. See the <code class="function">mkstemp()</code> documentation
702
683
on most UNIX-like systems. 
704
685
<p>
705
686
The parameter is a string that should follow the rules for
706
687
<code class="function">mkstemp()</code> templates, i.e. contain the string "XXXXXX". 
707
 
<a class="link" href="glib-File-Utilities.html#g-mkstemp"><code class="function">g_mkstemp()</code></a> is slightly more flexible than <code class="function">mkstemp()</code>
 
688
<a class="link" href="glib-File-Utilities.html#g-mkstemp" title="g_mkstemp ()"><code class="function">g_mkstemp()</code></a> is slightly more flexible than <code class="function">mkstemp()</code>
708
689
in that the sequence does not have to occur at the very end of the 
709
690
template. The X string will 
710
691
be modified to form the name of a file that didn't exist.
711
692
The string should be in the GLib file name encoding. Most importantly, 
712
693
on Windows it should be in UTF-8.</p>
713
694
<p>
714
 
 
715
695
</p>
716
696
<div class="variablelist"><table border="0">
717
697
<col align="left" valign="top">
718
698
<tbody>
719
699
<tr>
720
 
<td><p><span class="term"><em class="parameter"><code>tmpl</code></em>&#160;:</span></p></td>
 
700
<td><p><span class="term"><em class="parameter"><code>tmpl</code></em> :</span></p></td>
721
701
<td> template filename
722
702
</td>
723
703
</tr>
724
704
<tr>
725
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
 
705
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
726
706
<td> A file handle (as from <code class="function">open()</code>) to the file
727
707
opened for reading and writing. The file is opened in binary mode
728
708
on platforms where there is a difference. The file handle should be
734
714
</div>
735
715
<hr>
736
716
<div class="refsect2" lang="en">
737
 
<a name="id3167833"></a><h3>
738
 
<a name="g-file-open-tmp"></a>g_file_open_tmp ()</h3>
739
 
<a class="indexterm" name="id3167844"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint">gint</a>                g_file_open_tmp                     (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *tmpl,
740
 
                                                         <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> **name_used,
741
 
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);</pre>
 
717
<a name="g-file-open-tmp"></a><h3>g_file_open_tmp ()</h3>
 
718
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint">gint</a>                g_file_open_tmp                     (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *tmpl,
 
719
                                                         <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> **name_used,
 
720
                                                         <a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);</pre>
742
721
<p>
743
722
Opens a file for writing in the preferred directory for temporary
744
 
files (as returned by <a class="link" href="glib-Miscellaneous-Utility-Functions.html#g-get-tmp-dir"><code class="function">g_get_tmp_dir()</code></a>). 
 
723
files (as returned by <a class="link" href="glib-Miscellaneous-Utility-Functions.html#g-get-tmp-dir" title="g_get_tmp_dir ()"><code class="function">g_get_tmp_dir()</code></a>). 
745
724
</p>
746
725
<p>
747
726
<em class="parameter"><code>tmpl</code></em> should be a string in the GLib file name encoding containing 
748
 
a sequence of six 'X' characters, as the parameter to <a class="link" href="glib-File-Utilities.html#g-mkstemp"><code class="function">g_mkstemp()</code></a>.
 
727
a sequence of six 'X' characters, as the parameter to <a class="link" href="glib-File-Utilities.html#g-mkstemp" title="g_mkstemp ()"><code class="function">g_mkstemp()</code></a>.
749
728
However, unlike these functions, the template should only be a
750
729
basename, no directory components are allowed. If template is
751
 
<a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, a default template is used.
 
730
<a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>, a default template is used.
752
731
</p>
753
732
<p>
754
 
Note that in contrast to <a class="link" href="glib-File-Utilities.html#g-mkstemp"><code class="function">g_mkstemp()</code></a> (and <code class="function">mkstemp()</code>) 
 
733
Note that in contrast to <a class="link" href="glib-File-Utilities.html#g-mkstemp" title="g_mkstemp ()"><code class="function">g_mkstemp()</code></a> (and <code class="function">mkstemp()</code>) 
755
734
<em class="parameter"><code>tmpl</code></em> is not modified, and might thus be a read-only literal string.
756
735
</p>
757
736
<p>
758
 
The actual name used is returned in <em class="parameter"><code>name_used</code></em> if non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. This
759
 
string should be freed with <a class="link" href="glib-Memory-Allocation.html#g-free"><code class="function">g_free()</code></a> when not needed any longer.
 
737
The actual name used is returned in <em class="parameter"><code>name_used</code></em> if non-<a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>. This
 
738
string should be freed with <a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a> when not needed any longer.
760
739
The returned name is in the GLib file name encoding.</p>
761
740
<p>
762
 
 
763
741
</p>
764
742
<div class="variablelist"><table border="0">
765
743
<col align="left" valign="top">
766
744
<tbody>
767
745
<tr>
768
 
<td><p><span class="term"><em class="parameter"><code>tmpl</code></em>&#160;:</span></p></td>
769
 
<td> Template for file name, as in <a class="link" href="glib-File-Utilities.html#g-mkstemp"><code class="function">g_mkstemp()</code></a>, basename only,
770
 
       or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, to a default template
771
 
</td>
772
 
</tr>
773
 
<tr>
774
 
<td><p><span class="term"><em class="parameter"><code>name_used</code></em>&#160;:</span></p></td>
775
 
<td> location to store actual name used
776
 
</td>
777
 
</tr>
778
 
<tr>
779
 
<td><p><span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></p></td>
780
 
<td> return location for a <a class="link" href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a>
781
 
</td>
782
 
</tr>
783
 
<tr>
784
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
 
746
<td><p><span class="term"><em class="parameter"><code>tmpl</code></em> :</span></p></td>
 
747
<td> Template for file name, as in <a class="link" href="glib-File-Utilities.html#g-mkstemp" title="g_mkstemp ()"><code class="function">g_mkstemp()</code></a>, basename only,
 
748
       or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>, to a default template
 
749
</td>
 
750
</tr>
 
751
<tr>
 
752
<td><p><span class="term"><em class="parameter"><code>name_used</code></em> :</span></p></td>
 
753
<td> location to store actual name used, or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>
 
754
</td>
 
755
</tr>
 
756
<tr>
 
757
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
 
758
<td> return location for a <a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="type">GError</span></a>
 
759
</td>
 
760
</tr>
 
761
<tr>
 
762
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
785
763
<td> A file handle (as from <code class="function">open()</code>) to 
786
764
the file opened for reading and writing. The file is opened in binary 
787
765
mode on platforms where there is a difference. The file handle should be
794
772
</div>
795
773
<hr>
796
774
<div class="refsect2" lang="en">
797
 
<a name="id3168091"></a><h3>
798
 
<a name="g-file-read-link"></a>g_file_read_link ()</h3>
799
 
<a class="indexterm" name="id3168105"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar">gchar</a>*              g_file_read_link                    (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename,
800
 
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);</pre>
 
775
<a name="g-file-read-link"></a><h3>g_file_read_link ()</h3>
 
776
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *             g_file_read_link                    (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
 
777
                                                         <a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);</pre>
801
778
<p>
802
779
Reads the contents of the symbolic link <em class="parameter"><code>filename</code></em> like the POSIX
803
780
<code class="function">readlink()</code> function.  The returned string is in the encoding used
804
 
for filenames. Use <a class="link" 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>
 
781
for filenames. Use <a class="link" href="glib-Character-Set-Conversion.html#g-filename-to-utf8" title="g_filename_to_utf8 ()"><code class="function">g_filename_to_utf8()</code></a> to convert it to UTF-8.</p>
805
782
<p>
806
 
 
807
783
</p>
808
784
<div class="variablelist"><table border="0">
809
785
<col align="left" valign="top">
810
786
<tbody>
811
787
<tr>
812
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></p></td>
 
788
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
813
789
<td> the symbolic link
814
790
</td>
815
791
</tr>
816
792
<tr>
817
 
<td><p><span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></p></td>
818
 
<td> return location for a <a class="link" href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a>
 
793
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
 
794
<td> return location for a <a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="type">GError</span></a>
819
795
</td>
820
796
</tr>
821
797
<tr>
822
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
 
798
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
823
799
<td> A newly allocated string with the contents of the symbolic link, 
824
 
         or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if an error occurred.
 
800
         or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a> if an error occurred.
825
801
 
826
802
</td>
827
803
</tr>
828
804
</tbody>
829
805
</table></div>
830
 
<p class="since">Since  2.4
831
 
</p>
 
806
<p class="since">Since 2.4</p>
832
807
</div>
833
808
<hr>
834
809
<div class="refsect2" lang="en">
835
 
<a name="id3168244"></a><h3>
836
 
<a name="g-mkdir-with-parents"></a>g_mkdir_with_parents ()</h3>
837
 
<a class="indexterm" name="id3168259"></a><pre class="programlisting">int                 g_mkdir_with_parents                (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *pathname,
 
810
<a name="g-mkdir-with-parents"></a><h3>g_mkdir_with_parents ()</h3>
 
811
<pre class="programlisting">int                 g_mkdir_with_parents                (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *pathname,
838
812
                                                         int mode);</pre>
839
813
<p>
840
814
Create a directory if it doesn't already exist. Create intermediate
841
815
parent directories as needed, too.</p>
842
816
<p>
843
 
 
844
817
</p>
845
818
<div class="variablelist"><table border="0">
846
819
<col align="left" valign="top">
847
820
<tbody>
848
821
<tr>
849
 
<td><p><span class="term"><em class="parameter"><code>pathname</code></em>&#160;:</span></p></td>
 
822
<td><p><span class="term"><em class="parameter"><code>pathname</code></em> :</span></p></td>
850
823
<td> a pathname in the GLib file name encoding
851
824
</td>
852
825
</tr>
853
826
<tr>
854
 
<td><p><span class="term"><em class="parameter"><code>mode</code></em>&#160;:</span></p></td>
 
827
<td><p><span class="term"><em class="parameter"><code>mode</code></em> :</span></p></td>
855
828
<td> permissions to use for newly created directories
856
829
</td>
857
830
</tr>
858
831
<tr>
859
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
 
832
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
860
833
<td> 0 if the directory already exists, or was successfully
861
834
created. Returns -1 if an error occurred, with errno set.
862
835
 
864
837
</tr>
865
838
</tbody>
866
839
</table></div>
867
 
<p class="since">Since  2.8
868
 
</p>
 
840
<p class="since">Since 2.8</p>
869
841
</div>
870
842
<hr>
871
843
<div class="refsect2" lang="en">
872
 
<a name="id3168351"></a><h3>
873
 
<a name="GDir"></a>GDir</h3>
874
 
<a class="indexterm" name="id3168364"></a><pre class="programlisting">typedef struct _GDir GDir;</pre>
 
844
<a name="GDir"></a><h3>GDir</h3>
 
845
<pre class="programlisting">typedef struct _GDir GDir;</pre>
875
846
<p>
876
847
An opaque structure representing an opened directory.
877
848
</p>
878
849
</div>
879
850
<hr>
880
851
<div class="refsect2" lang="en">
881
 
<a name="id3168380"></a><h3>
882
 
<a name="g-dir-open"></a>g_dir_open ()</h3>
883
 
<a class="indexterm" name="id3168393"></a><pre class="programlisting"><a class="link" href="glib-File-Utilities.html#GDir">GDir</a>*               g_dir_open                          (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *path,
884
 
                                                         <a class="link" href="glib-Basic-Types.html#guint">guint</a> flags,
885
 
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);</pre>
 
852
<a name="g-dir-open"></a><h3>g_dir_open ()</h3>
 
853
<pre class="programlisting"><a class="link" href="glib-File-Utilities.html#GDir" title="GDir">GDir</a> *              g_dir_open                          (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *path,
 
854
                                                         <a class="link" href="glib-Basic-Types.html#guint" title="guint">guint</a> flags,
 
855
                                                         <a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);</pre>
886
856
<p>
887
857
Opens a directory for reading. The names of the files in the
888
 
directory can then be retrieved using <a class="link" href="glib-File-Utilities.html#g-dir-read-name"><code class="function">g_dir_read_name()</code></a>.</p>
 
858
directory can then be retrieved using <a class="link" href="glib-File-Utilities.html#g-dir-read-name" title="g_dir_read_name ()"><code class="function">g_dir_read_name()</code></a>.</p>
889
859
<p>
890
 
 
891
860
</p>
892
861
<div class="variablelist"><table border="0">
893
862
<col align="left" valign="top">
894
863
<tbody>
895
864
<tr>
896
 
<td><p><span class="term"><em class="parameter"><code>path</code></em>&#160;:</span></p></td>
 
865
<td><p><span class="term"><em class="parameter"><code>path</code></em> :</span></p></td>
897
866
<td> the path to the directory you are interested in. On Unix
898
867
        in the on-disk encoding. On Windows in UTF-8
899
868
</td>
900
869
</tr>
901
870
<tr>
902
 
<td><p><span class="term"><em class="parameter"><code>flags</code></em>&#160;:</span></p></td>
 
871
<td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
903
872
<td> Currently must be set to 0. Reserved for future use.
904
873
</td>
905
874
</tr>
906
875
<tr>
907
 
<td><p><span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></p></td>
908
 
<td> return location for a <a class="link" href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.
909
 
        If non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, an error will be set if and only if
910
 
        <a class="link" href="glib-File-Utilities.html#g-dir-open"><code class="function">g_dir_open()</code></a> fails.
 
876
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
 
877
<td> return location for a <a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="type">GError</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>.
 
878
        If non-<a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>, an error will be set if and only if
 
879
        <a class="link" href="glib-File-Utilities.html#g-dir-open" title="g_dir_open ()"><code class="function">g_dir_open()</code></a> fails.
911
880
</td>
912
881
</tr>
913
882
<tr>
914
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
915
 
<td> a newly allocated <a class="link" href="glib-File-Utilities.html#GDir"><span class="type">GDir</span></a> on success, <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on failure.
916
 
  If non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, you must free the result with <a class="link" href="glib-File-Utilities.html#g-dir-close"><code class="function">g_dir_close()</code></a>
 
883
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
 
884
<td> a newly allocated <a class="link" href="glib-File-Utilities.html#GDir" title="GDir"><span class="type">GDir</span></a> on success, <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a> on failure.
 
885
  If non-<a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>, you must free the result with <a class="link" href="glib-File-Utilities.html#g-dir-close" title="g_dir_close ()"><code class="function">g_dir_close()</code></a>
917
886
  when you are finished with it.
918
887
</td>
919
888
</tr>
922
891
</div>
923
892
<hr>
924
893
<div class="refsect2" lang="en">
925
 
<a name="id3168591"></a><h3>
926
 
<a name="g-dir-read-name"></a>g_dir_read_name ()</h3>
927
 
<a class="indexterm" name="id3168604"></a><pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a>*        g_dir_read_name                     (<a class="link" href="glib-File-Utilities.html#GDir">GDir</a> *dir);</pre>
 
894
<a name="g-dir-read-name"></a><h3>g_dir_read_name ()</h3>
 
895
<pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *       g_dir_read_name                     (<a class="link" href="glib-File-Utilities.html#GDir" title="GDir">GDir</a> *dir);</pre>
928
896
<p>
929
897
Retrieves the name of the next entry in the directory.  The '.' and
930
898
'..' entries are omitted. On Windows, the returned name is in
931
899
UTF-8. On Unix, it is in the on-disk encoding.</p>
932
900
<p>
933
 
 
934
901
</p>
935
902
<div class="variablelist"><table border="0">
936
903
<col align="left" valign="top">
937
904
<tbody>
938
905
<tr>
939
 
<td><p><span class="term"><em class="parameter"><code>dir</code></em>&#160;:</span></p></td>
940
 
<td> a <a class="link" href="glib-File-Utilities.html#GDir"><span class="type">GDir</span></a>* created by <a class="link" href="glib-File-Utilities.html#g-dir-open"><code class="function">g_dir_open()</code></a>
 
906
<td><p><span class="term"><em class="parameter"><code>dir</code></em> :</span></p></td>
 
907
<td> a <a class="link" href="glib-File-Utilities.html#GDir" title="GDir"><span class="type">GDir</span></a>* created by <a class="link" href="glib-File-Utilities.html#g-dir-open" title="g_dir_open ()"><code class="function">g_dir_open()</code></a>
941
908
</td>
942
909
</tr>
943
910
<tr>
944
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
945
 
<td> The entry's name or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if there are no 
 
911
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
 
912
<td> The entry's name or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a> if there are no 
946
913
  more entries. The return value is owned by GLib and
947
914
  must not be modified or freed.
948
915
</td>
952
919
</div>
953
920
<hr>
954
921
<div class="refsect2" lang="en">
955
 
<a name="id3168698"></a><h3>
956
 
<a name="g-dir-rewind"></a>g_dir_rewind ()</h3>
957
 
<a class="indexterm" name="id3168710"></a><pre class="programlisting">void                g_dir_rewind                        (<a class="link" href="glib-File-Utilities.html#GDir">GDir</a> *dir);</pre>
 
922
<a name="g-dir-rewind"></a><h3>g_dir_rewind ()</h3>
 
923
<pre class="programlisting">void                g_dir_rewind                        (<a class="link" href="glib-File-Utilities.html#GDir" title="GDir">GDir</a> *dir);</pre>
958
924
<p>
959
 
Resets the given directory. The next call to <a class="link" href="glib-File-Utilities.html#g-dir-read-name"><code class="function">g_dir_read_name()</code></a>
 
925
Resets the given directory. The next call to <a class="link" href="glib-File-Utilities.html#g-dir-read-name" title="g_dir_read_name ()"><code class="function">g_dir_read_name()</code></a>
960
926
will return the first entry again.</p>
961
927
<p>
962
 
 
963
928
</p>
964
929
<div class="variablelist"><table border="0">
965
930
<col align="left" valign="top">
966
931
<tbody><tr>
967
 
<td><p><span class="term"><em class="parameter"><code>dir</code></em>&#160;:</span></p></td>
968
 
<td> a <a class="link" href="glib-File-Utilities.html#GDir"><span class="type">GDir</span></a>* created by <a class="link" href="glib-File-Utilities.html#g-dir-open"><code class="function">g_dir_open()</code></a>
 
932
<td><p><span class="term"><em class="parameter"><code>dir</code></em> :</span></p></td>
 
933
<td> a <a class="link" href="glib-File-Utilities.html#GDir" title="GDir"><span class="type">GDir</span></a>* created by <a class="link" href="glib-File-Utilities.html#g-dir-open" title="g_dir_open ()"><code class="function">g_dir_open()</code></a>
969
934
</td>
970
935
</tr></tbody>
971
936
</table></div>
972
937
</div>
973
938
<hr>
974
939
<div class="refsect2" lang="en">
975
 
<a name="id3168790"></a><h3>
976
 
<a name="g-dir-close"></a>g_dir_close ()</h3>
977
 
<a class="indexterm" name="id3168802"></a><pre class="programlisting">void                g_dir_close                         (<a class="link" href="glib-File-Utilities.html#GDir">GDir</a> *dir);</pre>
 
940
<a name="g-dir-close"></a><h3>g_dir_close ()</h3>
 
941
<pre class="programlisting">void                g_dir_close                         (<a class="link" href="glib-File-Utilities.html#GDir" title="GDir">GDir</a> *dir);</pre>
978
942
<p>
979
943
Closes the directory and deallocates all related resources.</p>
980
944
<p>
981
 
 
982
945
</p>
983
946
<div class="variablelist"><table border="0">
984
947
<col align="left" valign="top">
985
948
<tbody><tr>
986
 
<td><p><span class="term"><em class="parameter"><code>dir</code></em>&#160;:</span></p></td>
987
 
<td> a <a class="link" href="glib-File-Utilities.html#GDir"><span class="type">GDir</span></a>* created by <a class="link" href="glib-File-Utilities.html#g-dir-open"><code class="function">g_dir_open()</code></a>
 
949
<td><p><span class="term"><em class="parameter"><code>dir</code></em> :</span></p></td>
 
950
<td> a <a class="link" href="glib-File-Utilities.html#GDir" title="GDir"><span class="type">GDir</span></a>* created by <a class="link" href="glib-File-Utilities.html#g-dir-open" title="g_dir_open ()"><code class="function">g_dir_open()</code></a>
988
951
</td>
989
952
</tr></tbody>
990
953
</table></div>
991
954
</div>
992
955
<hr>
993
956
<div class="refsect2" lang="en">
994
 
<a name="id3168871"></a><h3>
995
 
<a name="GMappedFile"></a>GMappedFile</h3>
996
 
<a class="indexterm" name="id3168883"></a><pre class="programlisting">typedef struct _GMappedFile GMappedFile;</pre>
 
957
<a name="GMappedFile"></a><h3>GMappedFile</h3>
 
958
<pre class="programlisting">typedef struct _GMappedFile GMappedFile;</pre>
997
959
<p>
998
 
The <a class="link" href="glib-File-Utilities.html#GMappedFile"><span class="type">GMappedFile</span></a> represents a file mapping created with
999
 
<a class="link" 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
 
960
The <a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="type">GMappedFile</span></a> represents a file mapping created with
 
961
<a class="link" href="glib-File-Utilities.html#g-mapped-file-new" title="g_mapped_file_new ()"><code class="function">g_mapped_file_new()</code></a>. It has only private members and should
1000
962
not be accessed directly.
1001
963
</p>
1002
964
</div>
1003
965
<hr>
1004
966
<div class="refsect2" lang="en">
1005
 
<a name="id3168918"></a><h3>
1006
 
<a name="g-mapped-file-new"></a>g_mapped_file_new ()</h3>
1007
 
<a class="indexterm" name="id3168934"></a><pre class="programlisting"><a class="link" href="glib-File-Utilities.html#GMappedFile">GMappedFile</a>*        g_mapped_file_new                   (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename,
1008
 
                                                         <a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> writable,
1009
 
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);</pre>
 
967
<a name="g-mapped-file-new"></a><h3>g_mapped_file_new ()</h3>
 
968
<pre class="programlisting"><a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile">GMappedFile</a> *       g_mapped_file_new                   (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
 
969
                                                         <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean">gboolean</a> writable,
 
970
                                                         <a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);</pre>
1010
971
<p>
1011
972
Maps a file into memory. On UNIX, this is using the <code class="function">mmap()</code> function.
1012
973
</p>
1013
974
<p>
1014
 
If <em class="parameter"><code>writable</code></em> is <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>, the mapped buffer may be modified, otherwise
 
975
If <em class="parameter"><code>writable</code></em> is <a class="link" href="glib-Standard-Macros.html#TRUE--CAPS" title="TRUE"><code class="literal">TRUE</code></a>, the mapped buffer may be modified, otherwise
1015
976
it is an error to modify the mapped buffer. Modifications to the buffer 
1016
977
are not visible to other processes mapping the same file, and are not 
1017
978
written back to the file.
1018
979
</p>
1019
980
<p>
1020
981
Note that modifications of the underlying file might affect the contents
1021
 
of the <a class="link" href="glib-File-Utilities.html#GMappedFile"><span class="type">GMappedFile</span></a>. Therefore, mapping should only be used if the file 
 
982
of the <a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="type">GMappedFile</span></a>. Therefore, mapping should only be used if the file 
1022
983
will not be modified, or if all modifications of the file are done
1023
 
atomically (e.g. using <a class="link" href="glib-File-Utilities.html#g-file-set-contents"><code class="function">g_file_set_contents()</code></a>).</p>
 
984
atomically (e.g. using <a class="link" href="glib-File-Utilities.html#g-file-set-contents" title="g_file_set_contents ()"><code class="function">g_file_set_contents()</code></a>).</p>
1024
985
<p>
1025
 
 
1026
986
</p>
1027
987
<div class="variablelist"><table border="0">
1028
988
<col align="left" valign="top">
1029
989
<tbody>
1030
990
<tr>
1031
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></p></td>
 
991
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1032
992
<td> The path of the file to load, in the GLib filename encoding
1033
993
</td>
1034
994
</tr>
1035
995
<tr>
1036
 
<td><p><span class="term"><em class="parameter"><code>writable</code></em>&#160;:</span></p></td>
 
996
<td><p><span class="term"><em class="parameter"><code>writable</code></em> :</span></p></td>
1037
997
<td> whether the mapping should be writable
1038
998
</td>
1039
999
</tr>
1040
1000
<tr>
1041
 
<td><p><span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></p></td>
1042
 
<td> return location for a <a class="link" href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
 
1001
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
 
1002
<td> return location for a <a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="type">GError</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>
1043
1003
</td>
1044
1004
</tr>
1045
1005
<tr>
1046
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
1047
 
<td> a newly allocated <a class="link" href="glib-File-Utilities.html#GMappedFile"><span class="type">GMappedFile</span></a> which must be freed
1048
 
   with <a class="link" href="glib-File-Utilities.html#g-mapped-file-free"><code class="function">g_mapped_file_free()</code></a>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if the mapping failed. 
 
1006
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
 
1007
<td> a newly allocated <a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="type">GMappedFile</span></a> which must be freed
 
1008
   with <a class="link" href="glib-File-Utilities.html#g-mapped-file-free" title="g_mapped_file_free ()"><code class="function">g_mapped_file_free()</code></a>, or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a> if the mapping failed. 
1049
1009
 
1050
1010
</td>
1051
1011
</tr>
1052
1012
</tbody>
1053
1013
</table></div>
1054
 
<p class="since">Since  2.8
1055
 
</p>
 
1014
<p class="since">Since 2.8</p>
1056
1015
</div>
1057
1016
<hr>
1058
1017
<div class="refsect2" lang="en">
1059
 
<a name="id3169154"></a><h3>
1060
 
<a name="g-mapped-file-free"></a>g_mapped_file_free ()</h3>
1061
 
<a class="indexterm" name="id3169170"></a><pre class="programlisting">void                g_mapped_file_free                  (<a class="link" href="glib-File-Utilities.html#GMappedFile">GMappedFile</a> *file);</pre>
 
1018
<a name="g-mapped-file-free"></a><h3>g_mapped_file_free ()</h3>
 
1019
<pre class="programlisting">void                g_mapped_file_free                  (<a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile">GMappedFile</a> *file);</pre>
1062
1020
<p>
1063
1021
Unmaps the buffer of <em class="parameter"><code>file</code></em> and frees it.</p>
1064
1022
<p>
1065
 
 
1066
1023
</p>
1067
1024
<div class="variablelist"><table border="0">
1068
1025
<col align="left" valign="top">
1069
1026
<tbody><tr>
1070
 
<td><p><span class="term"><em class="parameter"><code>file</code></em>&#160;:</span></p></td>
1071
 
<td> a <a class="link" href="glib-File-Utilities.html#GMappedFile"><span class="type">GMappedFile</span></a>
 
1027
<td><p><span class="term"><em class="parameter"><code>file</code></em> :</span></p></td>
 
1028
<td> a <a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="type">GMappedFile</span></a>
1072
1029
</td>
1073
1030
</tr></tbody>
1074
1031
</table></div>
1075
 
<p class="since">Since  2.8
1076
 
</p>
 
1032
<p class="since">Since 2.8</p>
1077
1033
</div>
1078
1034
<hr>
1079
1035
<div class="refsect2" lang="en">
1080
 
<a name="id3169240"></a><h3>
1081
 
<a name="g-mapped-file-get-length"></a>g_mapped_file_get_length ()</h3>
1082
 
<a class="indexterm" name="id3169255"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gsize">gsize</a>               g_mapped_file_get_length            (<a class="link" href="glib-File-Utilities.html#GMappedFile">GMappedFile</a> *file);</pre>
1083
 
<p>
1084
 
Returns the length of the contents of a <a class="link" href="glib-File-Utilities.html#GMappedFile"><span class="type">GMappedFile</span></a>.</p>
1085
 
<p>
1086
 
 
 
1036
<a name="g-mapped-file-get-length"></a><h3>g_mapped_file_get_length ()</h3>
 
1037
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gsize" title="gsize">gsize</a>               g_mapped_file_get_length            (<a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile">GMappedFile</a> *file);</pre>
 
1038
<p>
 
1039
Returns the length of the contents of a <a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="type">GMappedFile</span></a>.</p>
 
1040
<p>
1087
1041
</p>
1088
1042
<div class="variablelist"><table border="0">
1089
1043
<col align="left" valign="top">
1090
1044
<tbody>
1091
1045
<tr>
1092
 
<td><p><span class="term"><em class="parameter"><code>file</code></em>&#160;:</span></p></td>
1093
 
<td> a <a class="link" href="glib-File-Utilities.html#GMappedFile"><span class="type">GMappedFile</span></a>
 
1046
<td><p><span class="term"><em class="parameter"><code>file</code></em> :</span></p></td>
 
1047
<td> a <a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="type">GMappedFile</span></a>
1094
1048
</td>
1095
1049
</tr>
1096
1050
<tr>
1097
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
 
1051
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1098
1052
<td> the length of the contents of <em class="parameter"><code>file</code></em>.
1099
1053
 
1100
1054
</td>
1101
1055
</tr>
1102
1056
</tbody>
1103
1057
</table></div>
1104
 
<p class="since">Since  2.8
1105
 
</p>
 
1058
<p class="since">Since 2.8</p>
1106
1059
</div>
1107
1060
<hr>
1108
1061
<div class="refsect2" lang="en">
1109
 
<a name="id3169344"></a><h3>
1110
 
<a name="g-mapped-file-get-contents"></a>g_mapped_file_get_contents ()</h3>
1111
 
<a class="indexterm" name="id3169360"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar">gchar</a>*              g_mapped_file_get_contents          (<a class="link" href="glib-File-Utilities.html#GMappedFile">GMappedFile</a> *file);</pre>
 
1062
<a name="g-mapped-file-get-contents"></a><h3>g_mapped_file_get_contents ()</h3>
 
1063
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *             g_mapped_file_get_contents          (<a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile">GMappedFile</a> *file);</pre>
1112
1064
<p>
1113
 
Returns the contents of a <a class="link" href="glib-File-Utilities.html#GMappedFile"><span class="type">GMappedFile</span></a>. 
 
1065
Returns the contents of a <a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="type">GMappedFile</span></a>. 
1114
1066
</p>
1115
1067
<p>
1116
1068
Note that the contents may not be zero-terminated,
1117
 
even if the <a class="link" href="glib-File-Utilities.html#GMappedFile"><span class="type">GMappedFile</span></a> is backed by a text file.</p>
 
1069
even if the <a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="type">GMappedFile</span></a> is backed by a text file.</p>
1118
1070
<p>
1119
 
 
1120
1071
</p>
1121
1072
<div class="variablelist"><table border="0">
1122
1073
<col align="left" valign="top">
1123
1074
<tbody>
1124
1075
<tr>
1125
 
<td><p><span class="term"><em class="parameter"><code>file</code></em>&#160;:</span></p></td>
1126
 
<td> a <a class="link" href="glib-File-Utilities.html#GMappedFile"><span class="type">GMappedFile</span></a>
 
1076
<td><p><span class="term"><em class="parameter"><code>file</code></em> :</span></p></td>
 
1077
<td> a <a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="type">GMappedFile</span></a>
1127
1078
</td>
1128
1079
</tr>
1129
1080
<tr>
1130
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
 
1081
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1131
1082
<td> the contents of <em class="parameter"><code>file</code></em>.
1132
1083
 
1133
1084
</td>
1134
1085
</tr>
1135
1086
</tbody>
1136
1087
</table></div>
1137
 
<p class="since">Since  2.8
1138
 
</p>
 
1088
<p class="since">Since 2.8</p>
1139
1089
</div>
1140
1090
<hr>
1141
1091
<div class="refsect2" lang="en">
1142
 
<a name="id3169461"></a><h3>
1143
 
<a name="g-open"></a>g_open ()</h3>
1144
 
<a class="indexterm" name="id3169475"></a><pre class="programlisting">int                 g_open                              (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename,
 
1092
<a name="g-open"></a><h3>g_open ()</h3>
 
1093
<pre class="programlisting">int                 g_open                              (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
1145
1094
                                                         int flags,
1146
1095
                                                         int mode);</pre>
1147
1096
<p>
1148
1097
A wrapper for the POSIX <code class="function">open()</code> function. The <code class="function">open()</code> function is
1149
 
used to convert a pathname into a file descriptor. Note that on
1150
 
POSIX systems file descriptors are implemented by the operating
 
1098
used to convert a pathname into a file descriptor.
 
1099
</p>
 
1100
<p>
 
1101
On POSIX systems file descriptors are implemented by the operating
1151
1102
system. On Windows, it's the C library that implements <code class="function">open()</code> and
1152
 
file descriptors. The actual Windows API for opening files is
1153
 
something different.
1154
 
</p>
1155
 
<p>
1156
 
See the C library manual for more details about <code class="function">open()</code>.</p>
1157
 
<p>
1158
 
 
 
1103
file descriptors. The actual Win32 API for opening files is quite
 
1104
different, see MSDN documentation for <code class="function">CreateFile()</code>. The Win32 API
 
1105
uses file handles, which are more randomish integers, not small
 
1106
integers like file descriptors.
 
1107
</p>
 
1108
<p>
 
1109
Because file descriptors are specific to the C library on Windows,
 
1110
the file descriptor returned by this function makes sense only to
 
1111
functions in the same C library. Thus if the GLib-using code uses a
 
1112
different C library than GLib does, the file descriptor returned by
 
1113
this function cannot be passed to C library functions like <code class="function">write()</code>
 
1114
or <code class="function">read()</code>.
 
1115
</p>
 
1116
<p>
 
1117
See your C library manual for more details about <code class="function">open()</code>.</p>
 
1118
<p>
1159
1119
</p>
1160
1120
<div class="variablelist"><table border="0">
1161
1121
<col align="left" valign="top">
1162
1122
<tbody>
1163
1123
<tr>
1164
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></p></td>
 
1124
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1165
1125
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
1166
1126
</td>
1167
1127
</tr>
1168
1128
<tr>
1169
 
<td><p><span class="term"><em class="parameter"><code>flags</code></em>&#160;:</span></p></td>
1170
 
<td> as in <code class="function">open()</code>
1171
 
</td>
1172
 
</tr>
1173
 
<tr>
1174
 
<td><p><span class="term"><em class="parameter"><code>mode</code></em>&#160;:</span></p></td>
1175
 
<td> as in <code class="function">open()</code>
1176
 
</td>
1177
 
</tr>
1178
 
<tr>
1179
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
 
1129
<td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
 
1130
<td> as in <code class="function">open()</code>
 
1131
</td>
 
1132
</tr>
 
1133
<tr>
 
1134
<td><p><span class="term"><em class="parameter"><code>mode</code></em> :</span></p></td>
 
1135
<td> as in <code class="function">open()</code>
 
1136
</td>
 
1137
</tr>
 
1138
<tr>
 
1139
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1180
1140
<td> a new file descriptor, or -1 if an error occurred. The
1181
1141
return value can be used exactly like the return value from <code class="function">open()</code>.
1182
1142
 
1184
1144
</tr>
1185
1145
</tbody>
1186
1146
</table></div>
1187
 
<p class="since">Since  2.6
1188
 
</p>
 
1147
<p class="since">Since 2.6</p>
1189
1148
</div>
1190
1149
<hr>
1191
1150
<div class="refsect2" lang="en">
1192
 
<a name="id3169666"></a><h3>
1193
 
<a name="g-rename"></a>g_rename ()</h3>
1194
 
<a class="indexterm" name="id3169681"></a><pre class="programlisting">int                 g_rename                            (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *oldfilename,
1195
 
                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *newfilename);</pre>
 
1151
<a name="g-rename"></a><h3>g_rename ()</h3>
 
1152
<pre class="programlisting">int                 g_rename                            (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *oldfilename,
 
1153
                                                         const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *newfilename);</pre>
1196
1154
<p>
1197
1155
A wrapper for the POSIX <code class="function">rename()</code> function. The <code class="function">rename()</code> function 
1198
1156
renames a file, moving it between directories if required.
1199
1157
</p>
1200
1158
<p>
1201
1159
See your C library manual for more details about how <code class="function">rename()</code> works
1202
 
on your system. Note in particular that on Win9x it is not possible
1203
 
to rename a file if a file with the new name already exists. Also
1204
 
it is not possible in general on Windows to rename an open file.</p>
 
1160
on your system. It is not possible in general on Windows to rename
 
1161
a file that is open to some process.</p>
1205
1162
<p>
1206
 
 
1207
1163
</p>
1208
1164
<div class="variablelist"><table border="0">
1209
1165
<col align="left" valign="top">
1210
1166
<tbody>
1211
1167
<tr>
1212
 
<td><p><span class="term"><em class="parameter"><code>oldfilename</code></em>&#160;:</span></p></td>
 
1168
<td><p><span class="term"><em class="parameter"><code>oldfilename</code></em> :</span></p></td>
1213
1169
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
1214
1170
</td>
1215
1171
</tr>
1216
1172
<tr>
1217
 
<td><p><span class="term"><em class="parameter"><code>newfilename</code></em>&#160;:</span></p></td>
 
1173
<td><p><span class="term"><em class="parameter"><code>newfilename</code></em> :</span></p></td>
1218
1174
<td> a pathname in the GLib file name encoding
1219
1175
</td>
1220
1176
</tr>
1221
1177
<tr>
1222
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
 
1178
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1223
1179
<td> 0 if the renaming succeeded, -1 if an error occurred
1224
1180
 
1225
1181
</td>
1226
1182
</tr>
1227
1183
</tbody>
1228
1184
</table></div>
1229
 
<p class="since">Since  2.6
1230
 
</p>
 
1185
<p class="since">Since 2.6</p>
1231
1186
</div>
1232
1187
<hr>
1233
1188
<div class="refsect2" lang="en">
1234
 
<a name="id3169813"></a><h3>
1235
 
<a name="g-mkdir"></a>g_mkdir ()</h3>
1236
 
<a class="indexterm" name="id3169827"></a><pre class="programlisting">int                 g_mkdir                             (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename,
 
1189
<a name="g-mkdir"></a><h3>g_mkdir ()</h3>
 
1190
<pre class="programlisting">int                 g_mkdir                             (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
1237
1191
                                                         int mode);</pre>
1238
1192
<p>
1239
1193
A wrapper for the POSIX <code class="function">mkdir()</code> function. The <code class="function">mkdir()</code> function 
1241
1195
The mode argument is ignored on Windows.
1242
1196
</p>
1243
1197
<p>
1244
 
See the C library manual for more details about <code class="function">mkdir()</code>.</p>
 
1198
See your C library manual for more details about <code class="function">mkdir()</code>.</p>
1245
1199
<p>
1246
 
 
1247
1200
</p>
1248
1201
<div class="variablelist"><table border="0">
1249
1202
<col align="left" valign="top">
1250
1203
<tbody>
1251
1204
<tr>
1252
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></p></td>
 
1205
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1253
1206
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
1254
1207
</td>
1255
1208
</tr>
1256
1209
<tr>
1257
 
<td><p><span class="term"><em class="parameter"><code>mode</code></em>&#160;:</span></p></td>
 
1210
<td><p><span class="term"><em class="parameter"><code>mode</code></em> :</span></p></td>
1258
1211
<td> permissions to use for the newly created directory
1259
1212
</td>
1260
1213
</tr>
1261
1214
<tr>
1262
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
 
1215
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1263
1216
<td> 0 if the directory was successfully created, -1 if an error 
1264
1217
   occurred
1265
1218
 
1267
1220
</tr>
1268
1221
</tbody>
1269
1222
</table></div>
1270
 
<p class="since">Since  2.6
1271
 
</p>
 
1223
<p class="since">Since 2.6</p>
1272
1224
</div>
1273
1225
<hr>
1274
1226
<div class="refsect2" lang="en">
1275
 
<a name="id3169955"></a><h3>
1276
 
<a name="g-stat"></a>g_stat ()</h3>
1277
 
<a class="indexterm" name="id3169970"></a><pre class="programlisting">int                 g_stat                              (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename,
 
1227
<a name="g-stat"></a><h3>g_stat ()</h3>
 
1228
<pre class="programlisting">int                 g_stat                              (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
1278
1229
                                                         struct stat *buf);</pre>
1279
1230
<p>
1280
1231
A wrapper for the POSIX <code class="function">stat()</code> function. The <code class="function">stat()</code> function
1281
1232
returns information about a file. On Windows the <code class="function">stat()</code> function in
1282
 
the C library checks only the READONLY attribute and does not look
1283
 
at the ACL at all. Thus the protection bits in the st_mode field
1284
 
are a fabrication of little use.
 
1233
the C library checks only the FAT-style READONLY attribute and does
 
1234
not look at the ACL at all. Thus on Windows the protection bits in
 
1235
the st_mode field are a fabrication of little use.
1285
1236
</p>
1286
1237
<p>
1287
 
See the C library manual for more details about <code class="function">stat()</code>.</p>
 
1238
See your C library manual for more details about <code class="function">stat()</code>.</p>
1288
1239
<p>
1289
 
 
1290
1240
</p>
1291
1241
<div class="variablelist"><table border="0">
1292
1242
<col align="left" valign="top">
1293
1243
<tbody>
1294
1244
<tr>
1295
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></p></td>
 
1245
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1296
1246
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
1297
1247
</td>
1298
1248
</tr>
1299
1249
<tr>
1300
 
<td><p><span class="term"><em class="parameter"><code>buf</code></em>&#160;:</span></p></td>
 
1250
<td><p><span class="term"><em class="parameter"><code>buf</code></em> :</span></p></td>
1301
1251
<td> a pointer to a <span class="structname">stat</span> struct, which
1302
1252
   will be filled with the file information
1303
1253
</td>
1304
1254
</tr>
1305
1255
<tr>
1306
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
 
1256
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1307
1257
<td> 0 if the information was successfully retrieved, -1 if an error 
1308
1258
   occurred
1309
1259
 
1311
1261
</tr>
1312
1262
</tbody>
1313
1263
</table></div>
1314
 
<p class="since">Since  2.6
1315
 
</p>
 
1264
<p class="since">Since 2.6</p>
1316
1265
</div>
1317
1266
<hr>
1318
1267
<div class="refsect2" lang="en">
1319
 
<a name="id3170115"></a><h3>
1320
 
<a name="g-lstat"></a>g_lstat ()</h3>
1321
 
<a class="indexterm" name="id3170129"></a><pre class="programlisting">int                 g_lstat                             (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename,
 
1268
<a name="g-lstat"></a><h3>g_lstat ()</h3>
 
1269
<pre class="programlisting">int                 g_lstat                             (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
1322
1270
                                                         struct stat *buf);</pre>
1323
1271
<p>
1324
1272
A wrapper for the POSIX <code class="function">lstat()</code> function. The <code class="function">lstat()</code> function is
1325
1273
like <code class="function">stat()</code> except that in the case of symbolic links, it returns
1326
1274
information about the symbolic link itself and not the file that it
1327
 
refers to. If the system does not support symbolic links <a class="link" href="glib-File-Utilities.html#g-lstat"><code class="function">g_lstat()</code></a>
1328
 
is identical to <a class="link" href="glib-File-Utilities.html#g-stat"><code class="function">g_stat()</code></a>.
 
1275
refers to. If the system does not support symbolic links <a class="link" href="glib-File-Utilities.html#g-lstat" title="g_lstat ()"><code class="function">g_lstat()</code></a>
 
1276
is identical to <a class="link" href="glib-File-Utilities.html#g-stat" title="g_stat ()"><code class="function">g_stat()</code></a>.
1329
1277
</p>
1330
1278
<p>
1331
 
See the C library manual for more details about <code class="function">lstat()</code>.</p>
 
1279
See your C library manual for more details about <code class="function">lstat()</code>.</p>
1332
1280
<p>
1333
 
 
1334
1281
</p>
1335
1282
<div class="variablelist"><table border="0">
1336
1283
<col align="left" valign="top">
1337
1284
<tbody>
1338
1285
<tr>
1339
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></p></td>
 
1286
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1340
1287
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
1341
1288
</td>
1342
1289
</tr>
1343
1290
<tr>
1344
 
<td><p><span class="term"><em class="parameter"><code>buf</code></em>&#160;:</span></p></td>
 
1291
<td><p><span class="term"><em class="parameter"><code>buf</code></em> :</span></p></td>
1345
1292
<td> a pointer to a <span class="structname">stat</span> struct, which
1346
1293
   will be filled with the file information
1347
1294
</td>
1348
1295
</tr>
1349
1296
<tr>
1350
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
 
1297
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1351
1298
<td> 0 if the information was successfully retrieved, -1 if an error 
1352
1299
   occurred
1353
1300
 
1355
1302
</tr>
1356
1303
</tbody>
1357
1304
</table></div>
1358
 
<p class="since">Since  2.6
1359
 
</p>
 
1305
<p class="since">Since 2.6</p>
1360
1306
</div>
1361
1307
<hr>
1362
1308
<div class="refsect2" lang="en">
1363
 
<a name="id3170294"></a><h3>
1364
 
<a name="g-unlink"></a>g_unlink ()</h3>
1365
 
<a class="indexterm" name="id3170309"></a><pre class="programlisting">int                 g_unlink                            (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename);</pre>
 
1309
<a name="g-unlink"></a><h3>g_unlink ()</h3>
 
1310
<pre class="programlisting">int                 g_unlink                            (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename);</pre>
1366
1311
<p>
1367
1312
A wrapper for the POSIX <code class="function">unlink()</code> function. The <code class="function">unlink()</code> function 
1368
1313
deletes a name from the filesystem. If this was the last link to the 
1374
1319
that on Windows, it is in general not possible to delete files that
1375
1320
are open to some process, or mapped into memory.</p>
1376
1321
<p>
1377
 
 
1378
1322
</p>
1379
1323
<div class="variablelist"><table border="0">
1380
1324
<col align="left" valign="top">
1381
1325
<tbody>
1382
1326
<tr>
1383
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></p></td>
 
1327
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1384
1328
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
1385
1329
</td>
1386
1330
</tr>
1387
1331
<tr>
1388
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
 
1332
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1389
1333
<td> 0 if the name was successfully deleted, -1 if an error 
1390
1334
   occurred
1391
1335
 
1393
1337
</tr>
1394
1338
</tbody>
1395
1339
</table></div>
1396
 
<p class="since">Since  2.6
1397
 
</p>
 
1340
<p class="since">Since 2.6</p>
1398
1341
</div>
1399
1342
<hr>
1400
1343
<div class="refsect2" lang="en">
1401
 
<a name="id3170418"></a><h3>
1402
 
<a name="g-remove"></a>g_remove ()</h3>
1403
 
<a class="indexterm" name="id3170432"></a><pre class="programlisting">int                 g_remove                            (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename);</pre>
 
1344
<a name="g-remove"></a><h3>g_remove ()</h3>
 
1345
<pre class="programlisting">int                 g_remove                            (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename);</pre>
1404
1346
<p>
1405
1347
A wrapper for the POSIX <code class="function">remove()</code> function. The <code class="function">remove()</code> function
1406
1348
deletes a name from the filesystem.
1421
1363
fail. Any errno value set by <code class="function">remove()</code> will be overwritten by that
1422
1364
set by <code class="function">rmdir()</code>.</p>
1423
1365
<p>
1424
 
 
1425
1366
</p>
1426
1367
<div class="variablelist"><table border="0">
1427
1368
<col align="left" valign="top">
1428
1369
<tbody>
1429
1370
<tr>
1430
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></p></td>
 
1371
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1431
1372
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
1432
1373
</td>
1433
1374
</tr>
1434
1375
<tr>
1435
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
 
1376
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1436
1377
<td> 0 if the file was successfully removed, -1 if an error 
1437
1378
   occurred
1438
1379
 
1440
1381
</tr>
1441
1382
</tbody>
1442
1383
</table></div>
1443
 
<p class="since">Since  2.6
1444
 
</p>
 
1384
<p class="since">Since 2.6</p>
1445
1385
</div>
1446
1386
<hr>
1447
1387
<div class="refsect2" lang="en">
1448
 
<a name="id3170654"></a><h3>
1449
 
<a name="g-rmdir"></a>g_rmdir ()</h3>
1450
 
<a class="indexterm" name="id3170669"></a><pre class="programlisting">int                 g_rmdir                             (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename);</pre>
 
1388
<a name="g-rmdir"></a><h3>g_rmdir ()</h3>
 
1389
<pre class="programlisting">int                 g_rmdir                             (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename);</pre>
1451
1390
<p>
1452
1391
A wrapper for the POSIX <code class="function">rmdir()</code> function. The <code class="function">rmdir()</code> function
1453
1392
deletes a directory from the filesystem.
1456
1395
See your C library manual for more details about how <code class="function">rmdir()</code> works
1457
1396
on your system.</p>
1458
1397
<p>
1459
 
 
1460
1398
</p>
1461
1399
<div class="variablelist"><table border="0">
1462
1400
<col align="left" valign="top">
1463
1401
<tbody>
1464
1402
<tr>
1465
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></p></td>
 
1403
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1466
1404
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
1467
1405
</td>
1468
1406
</tr>
1469
1407
<tr>
1470
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
 
1408
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1471
1409
<td> 0 if the directory was successfully removed, -1 if an error 
1472
1410
   occurred
1473
1411
 
1475
1413
</tr>
1476
1414
</tbody>
1477
1415
</table></div>
1478
 
<p class="since">Since  2.6
1479
 
</p>
 
1416
<p class="since">Since 2.6</p>
1480
1417
</div>
1481
1418
<hr>
1482
1419
<div class="refsect2" lang="en">
1483
 
<a name="id3170774"></a><h3>
1484
 
<a name="g-fopen"></a>g_fopen ()</h3>
1485
 
<a class="indexterm" name="id3170788"></a><pre class="programlisting">FILE*               g_fopen                             (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename,
1486
 
                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *mode);</pre>
1487
 
<p>
1488
 
A wrapper for the POSIX <code class="function">fopen()</code> function. The <code class="function">fopen()</code> function opens
1489
 
a file and associates a new stream with it. 
1490
 
</p>
1491
 
<p>
1492
 
See the C library manual for more details about <code class="function">fopen()</code>.</p>
1493
 
<p>
1494
 
 
 
1420
<a name="g-fopen"></a><h3>g_fopen ()</h3>
 
1421
<pre class="programlisting">FILE *              g_fopen                             (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
 
1422
                                                         const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *mode);</pre>
 
1423
<p>
 
1424
A wrapper for the stdio <code class="function">fopen()</code> function. The <code class="function">fopen()</code> function
 
1425
opens a file and associates a new stream with it.
 
1426
</p>
 
1427
<p>
 
1428
Because file descriptors are specific to the C library on Windows,
 
1429
and a file descriptor is partof the <span class="type">FILE</span> struct, the
 
1430
<span class="type">FILE</span> pointer returned by this function makes sense
 
1431
only to functions in the same C library. Thus if the GLib-using
 
1432
code uses a different C library than GLib does, the
 
1433
<span class="type">FILE</span> pointer returned by this function cannot be
 
1434
passed to C library functions like <code class="function">fprintf()</code> or <code class="function">fread()</code>.
 
1435
</p>
 
1436
<p>
 
1437
See your C library manual for more details about <code class="function">fopen()</code>.</p>
 
1438
<p>
1495
1439
</p>
1496
1440
<div class="variablelist"><table border="0">
1497
1441
<col align="left" valign="top">
1498
1442
<tbody>
1499
1443
<tr>
1500
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></p></td>
 
1444
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1501
1445
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
1502
1446
</td>
1503
1447
</tr>
1504
1448
<tr>
1505
 
<td><p><span class="term"><em class="parameter"><code>mode</code></em>&#160;:</span></p></td>
 
1449
<td><p><span class="term"><em class="parameter"><code>mode</code></em> :</span></p></td>
1506
1450
<td> a string describing the mode in which the file should be 
1507
1451
  opened
1508
1452
</td>
1509
1453
</tr>
1510
1454
<tr>
1511
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
 
1455
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1512
1456
<td> A <span class="type">FILE</span> pointer if the file was successfully
1513
 
   opened, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if an error occurred
 
1457
   opened, or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a> if an error occurred
1514
1458
 
1515
1459
</td>
1516
1460
</tr>
1517
1461
</tbody>
1518
1462
</table></div>
1519
 
<p class="since">Since  2.6
1520
 
</p>
 
1463
<p class="since">Since 2.6</p>
1521
1464
</div>
1522
1465
<hr>
1523
1466
<div class="refsect2" lang="en">
1524
 
<a name="id3170929"></a><h3>
1525
 
<a name="g-freopen"></a>g_freopen ()</h3>
1526
 
<a class="indexterm" name="id3170944"></a><pre class="programlisting">FILE*               g_freopen                           (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename,
1527
 
                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *mode,
 
1467
<a name="g-freopen"></a><h3>g_freopen ()</h3>
 
1468
<pre class="programlisting">FILE *              g_freopen                           (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
 
1469
                                                         const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *mode,
1528
1470
                                                         FILE *stream);</pre>
1529
1471
<p>
1530
1472
A wrapper for the POSIX <code class="function">freopen()</code> function. The <code class="function">freopen()</code> function
1531
1473
opens a file and associates it with an existing stream.
1532
1474
</p>
1533
1475
<p>
1534
 
See the C library manual for more details about <code class="function">freopen()</code>.</p>
 
1476
See your C library manual for more details about <code class="function">freopen()</code>.</p>
1535
1477
<p>
1536
 
 
1537
1478
</p>
1538
1479
<div class="variablelist"><table border="0">
1539
1480
<col align="left" valign="top">
1540
1481
<tbody>
1541
1482
<tr>
1542
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></p></td>
 
1483
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1543
1484
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
1544
1485
</td>
1545
1486
</tr>
1546
1487
<tr>
1547
 
<td><p><span class="term"><em class="parameter"><code>mode</code></em>&#160;:</span></p></td>
 
1488
<td><p><span class="term"><em class="parameter"><code>mode</code></em> :</span></p></td>
1548
1489
<td> a string describing the mode in which the file should be 
1549
1490
  opened
1550
1491
</td>
1551
1492
</tr>
1552
1493
<tr>
1553
 
<td><p><span class="term"><em class="parameter"><code>stream</code></em>&#160;:</span></p></td>
1554
 
<td> an existing stream which will be reused, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
 
1494
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
 
1495
<td> an existing stream which will be reused, or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>
1555
1496
</td>
1556
1497
</tr>
1557
1498
<tr>
1558
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
 
1499
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1559
1500
<td> A <span class="type">FILE</span> pointer if the file was successfully
1560
 
   opened, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if an error occurred.
 
1501
   opened, or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a> if an error occurred.
1561
1502
 
1562
1503
</td>
1563
1504
</tr>
1564
1505
</tbody>
1565
1506
</table></div>
1566
 
<p class="since">Since  2.6
1567
 
</p>
 
1507
<p class="since">Since 2.6</p>
1568
1508
</div>
1569
1509
<hr>
1570
1510
<div class="refsect2" lang="en">
1571
 
<a name="id3171118"></a><h3>
1572
 
<a name="g-chmod"></a>g_chmod ()</h3>
1573
 
<a class="indexterm" name="id3171133"></a><pre class="programlisting">int                 g_chmod                             (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename,
 
1511
<a name="g-chmod"></a><h3>g_chmod ()</h3>
 
1512
<pre class="programlisting">int                 g_chmod                             (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
1574
1513
                                                         int mode);</pre>
1575
1514
<p>
1576
1515
A wrapper for the POSIX <code class="function">chmod()</code> function. The <code class="function">chmod()</code> function is
1577
 
used to set the permissions of a file system object. Note that on
1578
 
Windows the file protection mechanism is not at all POSIX-like, and
1579
 
the underlying <code class="function">chmod()</code> function in the C library just sets or
1580
 
clears the READONLY attribute. It does not touch any ACL. Software
1581
 
that needs to manage file permissions on Windows exactly should
1582
 
use the Win32 API.
1583
 
</p>
1584
 
<p>
1585
 
See the C library manual for more details about <code class="function">chmod()</code>.</p>
1586
 
<p>
1587
 
 
 
1516
used to set the permissions of a file system object.
 
1517
</p>
 
1518
<p>
 
1519
On Windows the file protection mechanism is not at all POSIX-like,
 
1520
and the underlying <code class="function">chmod()</code> function in the C library just sets or
 
1521
clears the FAT-style READONLY attribute. It does not touch any
 
1522
ACL. Software that needs to manage file permissions on Windows
 
1523
exactly should use the Win32 API.
 
1524
</p>
 
1525
<p>
 
1526
See your C library manual for more details about <code class="function">chmod()</code>.</p>
 
1527
<p>
1588
1528
</p>
1589
1529
<div class="variablelist"><table border="0">
1590
1530
<col align="left" valign="top">
1591
1531
<tbody>
1592
1532
<tr>
1593
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></p></td>
 
1533
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1594
1534
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
1595
1535
</td>
1596
1536
</tr>
1597
1537
<tr>
1598
 
<td><p><span class="term"><em class="parameter"><code>mode</code></em>&#160;:</span></p></td>
 
1538
<td><p><span class="term"><em class="parameter"><code>mode</code></em> :</span></p></td>
1599
1539
<td> as in <code class="function">chmod()</code>
1600
1540
</td>
1601
1541
</tr>
1602
1542
<tr>
1603
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
 
1543
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1604
1544
<td> zero if the operation succeeded, -1 on error.
1605
1545
 
1606
1546
</td>
1607
1547
</tr>
1608
1548
</tbody>
1609
1549
</table></div>
1610
 
<p class="since">Since  2.8
1611
 
</p>
 
1550
<p class="since">Since 2.8</p>
1612
1551
</div>
1613
1552
<hr>
1614
1553
<div class="refsect2" lang="en">
1615
 
<a name="id3171285"></a><h3>
1616
 
<a name="g-access"></a>g_access ()</h3>
1617
 
<a class="indexterm" name="id3171299"></a><pre class="programlisting">int                 g_access                            (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename,
 
1554
<a name="g-access"></a><h3>g_access ()</h3>
 
1555
<pre class="programlisting">int                 g_access                            (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
1618
1556
                                                         int mode);</pre>
1619
1557
<p>
1620
1558
A wrapper for the POSIX <code class="function">access()</code> function. This function is used to
1621
1559
test a pathname for one or several of read, write or execute
1622
 
permissions, or just existence. On Windows, the underlying <code class="function">access()</code>
1623
 
function in the C library only checks the READONLY attribute, and
1624
 
does not look at the ACL at all. Software that needs to handle file
1625
 
permissions on Windows more exactly should use the Win32 API.
1626
 
</p>
1627
 
<p>
1628
 
See the C library manual for more details about <code class="function">access()</code>.</p>
1629
 
<p>
1630
 
 
 
1560
permissions, or just existence.
 
1561
</p>
 
1562
<p>
 
1563
On Windows, the file protection mechanism is not at all POSIX-like,
 
1564
and the underlying function in the C library only checks the
 
1565
FAT-style READONLY attribute, and does not look at the ACL of a
 
1566
file at all. This function is this in practise almost useless on
 
1567
Windows. Software that needs to handle file permissions on Windows
 
1568
more exactly should use the Win32 API.
 
1569
</p>
 
1570
<p>
 
1571
See your C library manual for more details about <code class="function">access()</code>.</p>
 
1572
<p>
1631
1573
</p>
1632
1574
<div class="variablelist"><table border="0">
1633
1575
<col align="left" valign="top">
1634
1576
<tbody>
1635
1577
<tr>
1636
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></p></td>
 
1578
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1637
1579
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
1638
1580
</td>
1639
1581
</tr>
1640
1582
<tr>
1641
 
<td><p><span class="term"><em class="parameter"><code>mode</code></em>&#160;:</span></p></td>
 
1583
<td><p><span class="term"><em class="parameter"><code>mode</code></em> :</span></p></td>
1642
1584
<td> as in <code class="function">access()</code>
1643
1585
</td>
1644
1586
</tr>
1645
1587
<tr>
1646
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
 
1588
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1647
1589
<td> zero if the pathname refers to an existing file system
1648
1590
object that has all the tested permissions, or -1 otherwise or on
1649
1591
error.
1652
1594
</tr>
1653
1595
</tbody>
1654
1596
</table></div>
1655
 
<p class="since">Since  2.8
1656
 
</p>
 
1597
<p class="since">Since 2.8</p>
1657
1598
</div>
1658
1599
<hr>
1659
1600
<div class="refsect2" lang="en">
1660
 
<a name="id3171440"></a><h3>
1661
 
<a name="g-creat"></a>g_creat ()</h3>
1662
 
<a class="indexterm" name="id3171455"></a><pre class="programlisting">int                 g_creat                             (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename,
 
1601
<a name="g-creat"></a><h3>g_creat ()</h3>
 
1602
<pre class="programlisting">int                 g_creat                             (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
1663
1603
                                                         int mode);</pre>
1664
1604
<p>
1665
1605
A wrapper for the POSIX <code class="function">creat()</code> function. The <code class="function">creat()</code> function is
1666
1606
used to convert a pathname into a file descriptor, creating a file
1667
 
if necessary. Note that on POSIX systems file descriptors are
1668
 
implemented by the operating system. On Windows, it's the C library
1669
 
that implements <code class="function">creat()</code> and file descriptors. The actual Windows
1670
 
API for opening files is something different.
1671
 
</p>
1672
 
<p>
1673
 
See the C library manual for more details about <code class="function">creat()</code>.</p>
1674
 
<p>
1675
 
 
 
1607
if necessary.
 
1608
</p>
 
1609
<p>
 
1610
On POSIX systems file descriptors are implemented by the operating
 
1611
system. On Windows, it's the C library that implements <code class="function">creat()</code> and
 
1612
file descriptors. The actual Windows API for opening files is
 
1613
different, see MSDN documentation for <code class="function">CreateFile()</code>. The Win32 API
 
1614
uses file handles, which are more randomish integers, not small
 
1615
integers like file descriptors.
 
1616
</p>
 
1617
<p>
 
1618
Because file descriptors are specific to the C library on Windows,
 
1619
the file descriptor returned by this function makes sense only to
 
1620
functions in the same C library. Thus if the GLib-using code uses a
 
1621
different C library than GLib does, the file descriptor returned by
 
1622
this function cannot be passed to C library functions like <code class="function">write()</code>
 
1623
or <code class="function">read()</code>.
 
1624
</p>
 
1625
<p>
 
1626
See your C library manual for more details about <code class="function">creat()</code>.</p>
 
1627
<p>
1676
1628
</p>
1677
1629
<div class="variablelist"><table border="0">
1678
1630
<col align="left" valign="top">
1679
1631
<tbody>
1680
1632
<tr>
1681
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></p></td>
 
1633
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1682
1634
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
1683
1635
</td>
1684
1636
</tr>
1685
1637
<tr>
1686
 
<td><p><span class="term"><em class="parameter"><code>mode</code></em>&#160;:</span></p></td>
 
1638
<td><p><span class="term"><em class="parameter"><code>mode</code></em> :</span></p></td>
1687
1639
<td> as in <code class="function">creat()</code>
1688
1640
</td>
1689
1641
</tr>
1690
1642
<tr>
1691
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
 
1643
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1692
1644
<td> a new file descriptor, or -1 if an error occurred. The
1693
1645
return value can be used exactly like the return value from <code class="function">creat()</code>.
1694
1646
 
1696
1648
</tr>
1697
1649
</tbody>
1698
1650
</table></div>
1699
 
<p class="since">Since  2.8
1700
 
</p>
 
1651
<p class="since">Since 2.8</p>
1701
1652
</div>
1702
1653
<hr>
1703
1654
<div class="refsect2" lang="en">
1704
 
<a name="id3171615"></a><h3>
1705
 
<a name="g-chdir"></a>g_chdir ()</h3>
1706
 
<a class="indexterm" name="id3171630"></a><pre class="programlisting">int                 g_chdir                             (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *path);</pre>
 
1655
<a name="g-chdir"></a><h3>g_chdir ()</h3>
 
1656
<pre class="programlisting">int                 g_chdir                             (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *path);</pre>
1707
1657
<p>
1708
1658
A wrapper for the POSIX <code class="function">chdir()</code> function. The function changes the
1709
1659
current directory of the process to <em class="parameter"><code>path</code></em>.
1711
1661
<p>
1712
1662
See your C library manual for more details about <code class="function">chdir()</code>.</p>
1713
1663
<p>
1714
 
 
1715
1664
</p>
1716
1665
<div class="variablelist"><table border="0">
1717
1666
<col align="left" valign="top">
1718
1667
<tbody>
1719
1668
<tr>
1720
 
<td><p><span class="term"><em class="parameter"><code>path</code></em>&#160;:</span></p></td>
 
1669
<td><p><span class="term"><em class="parameter"><code>path</code></em> :</span></p></td>
1721
1670
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
1722
1671
</td>
1723
1672
</tr>
1724
1673
<tr>
1725
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
 
1674
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1726
1675
<td> 0 on success, -1 if an error occurred.
1727
1676
 
1728
1677
</td>
1729
1678
</tr>
1730
1679
</tbody>
1731
1680
</table></div>
1732
 
<p class="since">Since  2.8
1733
 
</p>
1734
 
</div>
1735
 
</div>
1736
 
<div class="refsect1" lang="en">
1737
 
<a name="id3171732"></a><div class="refsect2" lang="en"><a name="id3171733"></a></div>
1738
 
<hr>
1739
 
<div class="refsect2" lang="en"><a name="id3171734"></a></div>
1740
 
</div>
1741
 
</div>
 
1681
<p class="since">Since 2.8</p>
 
1682
</div>
 
1683
<hr>
 
1684
<div class="refsect2" lang="en">
 
1685
<a name="g-utime"></a><h3>g_utime ()</h3>
 
1686
<pre class="programlisting">int                 g_utime                             (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
 
1687
                                                         struct utimbuf *utb);</pre>
 
1688
<p>
 
1689
A wrapper for the POSIX <code class="function">utime()</code> function. The <code class="function">utime()</code> function
 
1690
sets the access and modification timestamps of a file.
 
1691
</p>
 
1692
<p>
 
1693
See your C library manual for more details about how <code class="function">utime()</code> works
 
1694
on your system.</p>
 
1695
<p>
 
1696
</p>
 
1697
<div class="variablelist"><table border="0">
 
1698
<col align="left" valign="top">
 
1699
<tbody>
 
1700
<tr>
 
1701
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
 
1702
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
 
1703
</td>
 
1704
</tr>
 
1705
<tr>
 
1706
<td><p><span class="term"><em class="parameter"><code>utb</code></em> :</span></p></td>
 
1707
<td> a pointer to a struct utimbuf.
 
1708
</td>
 
1709
</tr>
 
1710
<tr>
 
1711
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
 
1712
<td> 0 if the operation was successful, -1 if an error 
 
1713
   occurred
 
1714
 
 
1715
</td>
 
1716
</tr>
 
1717
</tbody>
 
1718
</table></div>
 
1719
<p class="since">Since 2.18</p>
 
1720
</div>
 
1721
</div>
 
1722
</div>
 
1723
<div class="footer">
 
1724
<hr>
 
1725
          Generated by GTK-Doc V1.11</div>
1742
1726
</body>
1743
1727
</html>