Imported Upstream version 2.50.2
[platform/upstream/glib.git] / docs / reference / glib / html / glib-File-Utilities.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>File Utilities: GLib Reference Manual</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7 <link rel="home" href="index.html" title="GLib Reference Manual">
8 <link rel="up" href="glib-utilities.html" title="GLib Utilities">
9 <link rel="prev" href="glib-Spawning-Processes.html" title="Spawning Processes">
10 <link rel="next" href="glib-URI-Functions.html" title="URI Functions">
11 <meta name="generator" content="GTK-Doc V1.25.1 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
13 </head>
14 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
16 <td width="100%" align="left" class="shortcuts">
17 <a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
18                   <a href="#glib-File-Utilities.description" class="shortcut">Description</a></span>
19 </td>
20 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
21 <td><a accesskey="u" href="glib-utilities.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
22 <td><a accesskey="p" href="glib-Spawning-Processes.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
23 <td><a accesskey="n" href="glib-URI-Functions.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
24 </tr></table>
25 <div class="refentry">
26 <a name="glib-File-Utilities"></a><div class="titlepage"></div>
27 <div class="refnamediv"><table width="100%"><tr>
28 <td valign="top">
29 <h2><span class="refentrytitle"><a name="glib-File-Utilities.top_of_page"></a>File Utilities</span></h2>
30 <p>File Utilities — various file-related functions</p>
31 </td>
32 <td class="gallery_image" valign="top" align="right"></td>
33 </tr></table></div>
34 <div class="refsect1">
35 <a name="glib-File-Utilities.functions"></a><h2>Functions</h2>
36 <div class="informaltable"><table class="informaltable" width="100%" border="0">
37 <colgroup>
38 <col width="150px" class="functions_return">
39 <col class="functions_name">
40 </colgroup>
41 <tbody>
42 <tr>
43 <td class="function_type">
44 <a class="link" href="glib-File-Utilities.html#GFileError" title="enum GFileError"><span class="returnvalue">GFileError</span></a>
45 </td>
46 <td class="function_name">
47 <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> <span class="c_punctuation">()</span>
48 </td>
49 </tr>
50 <tr>
51 <td class="function_type">
52 <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
53 </td>
54 <td class="function_name">
55 <a class="link" href="glib-File-Utilities.html#g-file-get-contents" title="g_file_get_contents ()">g_file_get_contents</a> <span class="c_punctuation">()</span>
56 </td>
57 </tr>
58 <tr>
59 <td class="function_type">
60 <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
61 </td>
62 <td class="function_name">
63 <a class="link" href="glib-File-Utilities.html#g-file-set-contents" title="g_file_set_contents ()">g_file_set_contents</a> <span class="c_punctuation">()</span>
64 </td>
65 </tr>
66 <tr>
67 <td class="function_type">
68 <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
69 </td>
70 <td class="function_name">
71 <a class="link" href="glib-File-Utilities.html#g-file-test" title="g_file_test ()">g_file_test</a> <span class="c_punctuation">()</span>
72 </td>
73 </tr>
74 <tr>
75 <td class="function_type">
76 <a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
77 </td>
78 <td class="function_name">
79 <a class="link" href="glib-File-Utilities.html#g-mkstemp" title="g_mkstemp ()">g_mkstemp</a> <span class="c_punctuation">()</span>
80 </td>
81 </tr>
82 <tr>
83 <td class="function_type">
84 <a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
85 </td>
86 <td class="function_name">
87 <a class="link" href="glib-File-Utilities.html#g-mkstemp-full" title="g_mkstemp_full ()">g_mkstemp_full</a> <span class="c_punctuation">()</span>
88 </td>
89 </tr>
90 <tr>
91 <td class="function_type">
92 <a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
93 </td>
94 <td class="function_name">
95 <a class="link" href="glib-File-Utilities.html#g-file-open-tmp" title="g_file_open_tmp ()">g_file_open_tmp</a> <span class="c_punctuation">()</span>
96 </td>
97 </tr>
98 <tr>
99 <td class="function_type">
100 <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
101 </td>
102 <td class="function_name">
103 <a class="link" href="glib-File-Utilities.html#g-file-read-link" title="g_file_read_link ()">g_file_read_link</a> <span class="c_punctuation">()</span>
104 </td>
105 </tr>
106 <tr>
107 <td class="function_type">
108 <a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
109 </td>
110 <td class="function_name">
111 <a class="link" href="glib-File-Utilities.html#g-mkdir-with-parents" title="g_mkdir_with_parents ()">g_mkdir_with_parents</a> <span class="c_punctuation">()</span>
112 </td>
113 </tr>
114 <tr>
115 <td class="function_type">
116 <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
117 </td>
118 <td class="function_name">
119 <a class="link" href="glib-File-Utilities.html#g-mkdtemp" title="g_mkdtemp ()">g_mkdtemp</a> <span class="c_punctuation">()</span>
120 </td>
121 </tr>
122 <tr>
123 <td class="function_type">
124 <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
125 </td>
126 <td class="function_name">
127 <a class="link" href="glib-File-Utilities.html#g-mkdtemp-full" title="g_mkdtemp_full ()">g_mkdtemp_full</a> <span class="c_punctuation">()</span>
128 </td>
129 </tr>
130 <tr>
131 <td class="function_type">
132 <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
133 </td>
134 <td class="function_name">
135 <a class="link" href="glib-File-Utilities.html#g-dir-make-tmp" title="g_dir_make_tmp ()">g_dir_make_tmp</a> <span class="c_punctuation">()</span>
136 </td>
137 </tr>
138 <tr>
139 <td class="function_type">
140 <a class="link" href="glib-File-Utilities.html#GDir" title="GDir"><span class="returnvalue">GDir</span></a> *
141 </td>
142 <td class="function_name">
143 <a class="link" href="glib-File-Utilities.html#g-dir-open" title="g_dir_open ()">g_dir_open</a> <span class="c_punctuation">()</span>
144 </td>
145 </tr>
146 <tr>
147 <td class="function_type">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
148 </td>
149 <td class="function_name">
150 <a class="link" href="glib-File-Utilities.html#g-dir-read-name" title="g_dir_read_name ()">g_dir_read_name</a> <span class="c_punctuation">()</span>
151 </td>
152 </tr>
153 <tr>
154 <td class="function_type">
155 <span class="returnvalue">void</span>
156 </td>
157 <td class="function_name">
158 <a class="link" href="glib-File-Utilities.html#g-dir-rewind" title="g_dir_rewind ()">g_dir_rewind</a> <span class="c_punctuation">()</span>
159 </td>
160 </tr>
161 <tr>
162 <td class="function_type">
163 <span class="returnvalue">void</span>
164 </td>
165 <td class="function_name">
166 <a class="link" href="glib-File-Utilities.html#g-dir-close" title="g_dir_close ()">g_dir_close</a> <span class="c_punctuation">()</span>
167 </td>
168 </tr>
169 <tr>
170 <td class="function_type">
171 <a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="returnvalue">GMappedFile</span></a> *
172 </td>
173 <td class="function_name">
174 <a class="link" href="glib-File-Utilities.html#g-mapped-file-new" title="g_mapped_file_new ()">g_mapped_file_new</a> <span class="c_punctuation">()</span>
175 </td>
176 </tr>
177 <tr>
178 <td class="function_type">
179 <a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="returnvalue">GMappedFile</span></a> *
180 </td>
181 <td class="function_name">
182 <a class="link" href="glib-File-Utilities.html#g-mapped-file-new-from-fd" title="g_mapped_file_new_from_fd ()">g_mapped_file_new_from_fd</a> <span class="c_punctuation">()</span>
183 </td>
184 </tr>
185 <tr>
186 <td class="function_type">
187 <a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="returnvalue">GMappedFile</span></a> *
188 </td>
189 <td class="function_name">
190 <a class="link" href="glib-File-Utilities.html#g-mapped-file-ref" title="g_mapped_file_ref ()">g_mapped_file_ref</a> <span class="c_punctuation">()</span>
191 </td>
192 </tr>
193 <tr>
194 <td class="function_type">
195 <span class="returnvalue">void</span>
196 </td>
197 <td class="function_name">
198 <a class="link" href="glib-File-Utilities.html#g-mapped-file-unref" title="g_mapped_file_unref ()">g_mapped_file_unref</a> <span class="c_punctuation">()</span>
199 </td>
200 </tr>
201 <tr>
202 <td class="function_type">
203 <span class="returnvalue">void</span>
204 </td>
205 <td class="function_name">
206 <a class="link" href="glib-File-Utilities.html#g-mapped-file-free" title="g_mapped_file_free ()">g_mapped_file_free</a> <span class="c_punctuation">()</span>
207 </td>
208 </tr>
209 <tr>
210 <td class="function_type">
211 <a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a>
212 </td>
213 <td class="function_name">
214 <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> <span class="c_punctuation">()</span>
215 </td>
216 </tr>
217 <tr>
218 <td class="function_type">
219 <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
220 </td>
221 <td class="function_name">
222 <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> <span class="c_punctuation">()</span>
223 </td>
224 </tr>
225 <tr>
226 <td class="function_type">
227 <a class="link" href="glib-Byte-Arrays.html#GBytes" title="GBytes"><span class="returnvalue">GBytes</span></a> *
228 </td>
229 <td class="function_name">
230 <a class="link" href="glib-File-Utilities.html#g-mapped-file-get-bytes" title="g_mapped_file_get_bytes ()">g_mapped_file_get_bytes</a> <span class="c_punctuation">()</span>
231 </td>
232 </tr>
233 <tr>
234 <td class="function_type">
235 <span class="returnvalue">int</span>
236 </td>
237 <td class="function_name">
238 <a class="link" href="glib-File-Utilities.html#g-open" title="g_open ()">g_open</a> <span class="c_punctuation">()</span>
239 </td>
240 </tr>
241 <tr>
242 <td class="function_type">
243 <span class="returnvalue">int</span>
244 </td>
245 <td class="function_name">
246 <a class="link" href="glib-File-Utilities.html#g-rename" title="g_rename ()">g_rename</a> <span class="c_punctuation">()</span>
247 </td>
248 </tr>
249 <tr>
250 <td class="function_type">
251 <span class="returnvalue">int</span>
252 </td>
253 <td class="function_name">
254 <a class="link" href="glib-File-Utilities.html#g-mkdir" title="g_mkdir ()">g_mkdir</a> <span class="c_punctuation">()</span>
255 </td>
256 </tr>
257 <tr>
258 <td class="function_type">
259 <span class="returnvalue">int</span>
260 </td>
261 <td class="function_name">
262 <a class="link" href="glib-File-Utilities.html#g-stat" title="g_stat ()">g_stat</a> <span class="c_punctuation">()</span>
263 </td>
264 </tr>
265 <tr>
266 <td class="function_type">
267 <span class="returnvalue">int</span>
268 </td>
269 <td class="function_name">
270 <a class="link" href="glib-File-Utilities.html#g-lstat" title="g_lstat ()">g_lstat</a> <span class="c_punctuation">()</span>
271 </td>
272 </tr>
273 <tr>
274 <td class="function_type">
275 <span class="returnvalue">int</span>
276 </td>
277 <td class="function_name">
278 <a class="link" href="glib-File-Utilities.html#g-unlink" title="g_unlink ()">g_unlink</a> <span class="c_punctuation">()</span>
279 </td>
280 </tr>
281 <tr>
282 <td class="function_type">
283 <span class="returnvalue">int</span>
284 </td>
285 <td class="function_name">
286 <a class="link" href="glib-File-Utilities.html#g-remove" title="g_remove ()">g_remove</a> <span class="c_punctuation">()</span>
287 </td>
288 </tr>
289 <tr>
290 <td class="function_type">
291 <span class="returnvalue">int</span>
292 </td>
293 <td class="function_name">
294 <a class="link" href="glib-File-Utilities.html#g-rmdir" title="g_rmdir ()">g_rmdir</a> <span class="c_punctuation">()</span>
295 </td>
296 </tr>
297 <tr>
298 <td class="function_type">
299 <span class="returnvalue">FILE</span> *
300 </td>
301 <td class="function_name">
302 <a class="link" href="glib-File-Utilities.html#g-fopen" title="g_fopen ()">g_fopen</a> <span class="c_punctuation">()</span>
303 </td>
304 </tr>
305 <tr>
306 <td class="function_type">
307 <span class="returnvalue">FILE</span> *
308 </td>
309 <td class="function_name">
310 <a class="link" href="glib-File-Utilities.html#g-freopen" title="g_freopen ()">g_freopen</a> <span class="c_punctuation">()</span>
311 </td>
312 </tr>
313 <tr>
314 <td class="function_type">
315 <span class="returnvalue">int</span>
316 </td>
317 <td class="function_name">
318 <a class="link" href="glib-File-Utilities.html#g-chmod" title="g_chmod ()">g_chmod</a> <span class="c_punctuation">()</span>
319 </td>
320 </tr>
321 <tr>
322 <td class="function_type">
323 <span class="returnvalue">int</span>
324 </td>
325 <td class="function_name">
326 <a class="link" href="glib-File-Utilities.html#g-access" title="g_access ()">g_access</a> <span class="c_punctuation">()</span>
327 </td>
328 </tr>
329 <tr>
330 <td class="function_type">
331 <span class="returnvalue">int</span>
332 </td>
333 <td class="function_name">
334 <a class="link" href="glib-File-Utilities.html#g-creat" title="g_creat ()">g_creat</a> <span class="c_punctuation">()</span>
335 </td>
336 </tr>
337 <tr>
338 <td class="function_type">
339 <span class="returnvalue">int</span>
340 </td>
341 <td class="function_name">
342 <a class="link" href="glib-File-Utilities.html#g-chdir" title="g_chdir ()">g_chdir</a> <span class="c_punctuation">()</span>
343 </td>
344 </tr>
345 <tr>
346 <td class="function_type">
347 <span class="returnvalue">int</span>
348 </td>
349 <td class="function_name">
350 <a class="link" href="glib-File-Utilities.html#g-utime" title="g_utime ()">g_utime</a> <span class="c_punctuation">()</span>
351 </td>
352 </tr>
353 <tr>
354 <td class="function_type">
355 <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
356 </td>
357 <td class="function_name">
358 <a class="link" href="glib-File-Utilities.html#g-close" title="g_close ()">g_close</a> <span class="c_punctuation">()</span>
359 </td>
360 </tr>
361 </tbody>
362 </table></div>
363 </div>
364 <div class="refsect1">
365 <a name="glib-File-Utilities.other"></a><h2>Types and Values</h2>
366 <div class="informaltable"><table class="informaltable" width="100%" border="0">
367 <colgroup>
368 <col width="150px" class="name">
369 <col class="description">
370 </colgroup>
371 <tbody>
372 <tr>
373 <td class="datatype_keyword">enum</td>
374 <td class="function_name"><a class="link" href="glib-File-Utilities.html#GFileError" title="enum GFileError">GFileError</a></td>
375 </tr>
376 <tr>
377 <td class="define_keyword">#define</td>
378 <td class="function_name"><a class="link" href="glib-File-Utilities.html#G-FILE-ERROR:CAPS" title="G_FILE_ERROR">G_FILE_ERROR</a></td>
379 </tr>
380 <tr>
381 <td class="datatype_keyword">enum</td>
382 <td class="function_name"><a class="link" href="glib-File-Utilities.html#GFileTest" title="enum GFileTest">GFileTest</a></td>
383 </tr>
384 <tr>
385 <td class="datatype_keyword"> </td>
386 <td class="function_name"><a class="link" href="glib-File-Utilities.html#GDir" title="GDir">GDir</a></td>
387 </tr>
388 <tr>
389 <td class="datatype_keyword"> </td>
390 <td class="function_name"><a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile">GMappedFile</a></td>
391 </tr>
392 <tr>
393 <td class="typedef_keyword">typedef</td>
394 <td class="function_name"><a class="link" href="glib-File-Utilities.html#GStatBuf" title="GStatBuf">GStatBuf</a></td>
395 </tr>
396 </tbody>
397 </table></div>
398 </div>
399 <div class="refsect1">
400 <a name="glib-File-Utilities.includes"></a><h2>Includes</h2>
401 <pre class="synopsis">#include &lt;glib.h&gt;
402 #include &lt;glib/gstdio.h&gt;
403 </pre>
404 </div>
405 <div class="refsect1">
406 <a name="glib-File-Utilities.description"></a><h2>Description</h2>
407 <p>There is a group of functions which wrap the common POSIX functions
408 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>,
409 <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
410 wrappers is to make it possible to handle file names with any Unicode
411 characters in them on Windows without having to use ifdefs and the
412 wide character API in the application code.</p>
413 <p>The pathname argument should be in the GLib file name encoding.
414 On POSIX this is the actual on-disk encoding which might correspond
415 to the locale settings of the process (or the <code class="literal">G_FILENAME_ENCODING</code>
416 environment variable), or not.</p>
417 <p>On Windows the GLib file name encoding is UTF-8. Note that the
418 Microsoft C library does not use UTF-8, but has separate APIs for
419 current system code page and wide characters (UTF-16). The GLib
420 wrappers call the wide character API if present (on modern Windows
421 systems), otherwise convert to/from the system code page.</p>
422 <p>Another group of functions allows to open and read directories
423 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>,
424 <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>.</p>
425 </div>
426 <div class="refsect1">
427 <a name="glib-File-Utilities.functions_details"></a><h2>Functions</h2>
428 <div class="refsect2">
429 <a name="g-file-error-from-errno"></a><h3>g_file_error_from_errno ()</h3>
430 <pre class="programlisting"><a class="link" href="glib-File-Utilities.html#GFileError" title="enum GFileError"><span class="returnvalue">GFileError</span></a>
431 g_file_error_from_errno (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="type">gint</span></a> err_no</code></em>);</pre>
432 <p>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>err_no</code></em>
433 .
434 For example, if you pass in <code class="literal">EEXIST</code> this function returns
435 <a class="link" href="glib-File-Utilities.html#G-FILE-ERROR-EXIST:CAPS"><span class="type">G_FILE_ERROR_EXIST</span></a>. Unlike <code class="literal">errno</code> values, you can portably
436 assume that all <a class="link" href="glib-File-Utilities.html#GFileError" title="enum GFileError"><span class="type">GFileError</span></a> values will exist.</p>
437 <p>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="struct GError"><span class="type">GError</span></a> returned
438 from a function that manipulates files. So you would use
439 <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="struct GError"><span class="type">GError</span></a>.</p>
440 <div class="refsect3">
441 <a name="g-file-error-from-errno.parameters"></a><h4>Parameters</h4>
442 <div class="informaltable"><table class="informaltable" width="100%" border="0">
443 <colgroup>
444 <col width="150px" class="parameters_name">
445 <col class="parameters_description">
446 <col width="200px" class="parameters_annotations">
447 </colgroup>
448 <tbody><tr>
449 <td class="parameter_name"><p>err_no</p></td>
450 <td class="parameter_description"><p>an "errno" value</p></td>
451 <td class="parameter_annotations"> </td>
452 </tr></tbody>
453 </table></div>
454 </div>
455 <div class="refsect3">
456 <a name="g-file-error-from-errno.returns"></a><h4>Returns</h4>
457 <p> <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>
458 </p>
459 </div>
460 </div>
461 <hr>
462 <div class="refsect2">
463 <a name="g-file-get-contents"></a><h3>g_file_get_contents ()</h3>
464 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
465 g_file_get_contents (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *filename</code></em>,
466                      <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> **contents</code></em>,
467                      <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> *length</code></em>,
468                      <em class="parameter"><code><a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> **error</code></em>);</pre>
469 <p>Reads an entire file into allocated memory, with good error
470 checking.</p>
471 <p>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>
472  to the file
473 contents and <em class="parameter"><code>length</code></em>
474  to the length of the file contents in bytes. The string
475 stored in <em class="parameter"><code>contents</code></em>
476  will be nul-terminated, so for text files you can pass
477 <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>
478  argument. If the call was not successful, it returns
479 <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>
480 . 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
481 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,
482 <em class="parameter"><code>contents</code></em>
483  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>
484  is set to zero.</p>
485 <div class="refsect3">
486 <a name="g-file-get-contents.parameters"></a><h4>Parameters</h4>
487 <div class="informaltable"><table class="informaltable" width="100%" border="0">
488 <colgroup>
489 <col width="150px" class="parameters_name">
490 <col class="parameters_description">
491 <col width="200px" class="parameters_annotations">
492 </colgroup>
493 <tbody>
494 <tr>
495 <td class="parameter_name"><p>filename</p></td>
496 <td class="parameter_description"><p> name of a file to read contents from, in the GLib file name encoding. </p></td>
497 <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename]</span></td>
498 </tr>
499 <tr>
500 <td class="parameter_name"><p>contents</p></td>
501 <td class="parameter_description"><p> location to store an allocated string, use <a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a> to free
502 the returned string. </p></td>
503 <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=length][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> guint8]</span></td>
504 </tr>
505 <tr>
506 <td class="parameter_name"><p>length</p></td>
507 <td class="parameter_description"><p> 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>. </p></td>
508 <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
509 </tr>
510 <tr>
511 <td class="parameter_name"><p>error</p></td>
512 <td class="parameter_description"><p>return location for a <a class="link" href="glib-Error-Reporting.html#GError" title="struct 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></p></td>
513 <td class="parameter_annotations"> </td>
514 </tr>
515 </tbody>
516 </table></div>
517 </div>
518 <div class="refsect3">
519 <a name="g-file-get-contents.returns"></a><h4>Returns</h4>
520 <p> <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</p>
521 </div>
522 </div>
523 <hr>
524 <div class="refsect2">
525 <a name="g-file-set-contents"></a><h3>g_file_set_contents ()</h3>
526 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
527 g_file_set_contents (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *filename</code></em>,
528                      <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *contents</code></em>,
529                      <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="type">gssize</span></a> length</code></em>,
530                      <em class="parameter"><code><a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> **error</code></em>);</pre>
531 <p>Writes all of <em class="parameter"><code>contents</code></em>
532  to a file named <em class="parameter"><code>filename</code></em>
533 , with good error checking.
534 If a file called <em class="parameter"><code>filename</code></em>
535  already exists it will be overwritten.</p>
536 <p>This write is atomic in the sense that it is first written to a temporary
537 file which is then renamed to the final name. Notes:</p>
538 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
539 <li class="listitem"><p>On UNIX, if <em class="parameter"><code>filename</code></em>
540  already exists hard links to <em class="parameter"><code>filename</code></em>
541  will break.
542 Also since the file is recreated, existing permissions, access control
543 lists, metadata etc. may be lost. If <em class="parameter"><code>filename</code></em>
544  is a symbolic link,
545 the link itself will be replaced, not the linked file.</p></li>
546 <li class="listitem"><p>On Windows renaming a file will not remove an existing file with the
547 new name, so on Windows there is a race condition between the existing
548 file being removed and the temporary file being renamed.</p></li>
549 <li class="listitem"><p>On Windows there is no way to remove a file that is open to some
550 process, or mapped into memory. Thus, this function will fail if
551 <em class="parameter"><code>filename</code></em>
552  already exists and is open.</p></li>
553 </ul></div>
554 <p>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>. If the call was not successful,
555 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>
556 . 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>.
557 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>
558 <p>Note that the name for the temporary file is constructed by appending up
559 to 7 characters to <em class="parameter"><code>filename</code></em>
560 .</p>
561 <div class="refsect3">
562 <a name="g-file-set-contents.parameters"></a><h4>Parameters</h4>
563 <div class="informaltable"><table class="informaltable" width="100%" border="0">
564 <colgroup>
565 <col width="150px" class="parameters_name">
566 <col class="parameters_description">
567 <col width="200px" class="parameters_annotations">
568 </colgroup>
569 <tbody>
570 <tr>
571 <td class="parameter_name"><p>filename</p></td>
572 <td class="parameter_description"><p> name of a file to write <em class="parameter"><code>contents</code></em>
573 to, in the GLib file name
574 encoding. </p></td>
575 <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename]</span></td>
576 </tr>
577 <tr>
578 <td class="parameter_name"><p>contents</p></td>
579 <td class="parameter_description"><p> string to write to the file. </p></td>
580 <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=length][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> guint8]</span></td>
581 </tr>
582 <tr>
583 <td class="parameter_name"><p>length</p></td>
584 <td class="parameter_description"><p>length of <em class="parameter"><code>contents</code></em>
585 , or -1 if <em class="parameter"><code>contents</code></em>
586 is a nul-terminated string</p></td>
587 <td class="parameter_annotations"> </td>
588 </tr>
589 <tr>
590 <td class="parameter_name"><p>error</p></td>
591 <td class="parameter_description"><p>return location for a <a class="link" href="glib-Error-Reporting.html#GError" title="struct 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></p></td>
592 <td class="parameter_annotations"> </td>
593 </tr>
594 </tbody>
595 </table></div>
596 </div>
597 <div class="refsect3">
598 <a name="g-file-set-contents.returns"></a><h4>Returns</h4>
599 <p> <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</p>
600 </div>
601 <p class="since">Since: <a class="link" href="api-index-2-8.html#api-index-2.8">2.8</a></p>
602 </div>
603 <hr>
604 <div class="refsect2">
605 <a name="g-file-test"></a><h3>g_file_test ()</h3>
606 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
607 g_file_test (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *filename</code></em>,
608              <em class="parameter"><code><a class="link" href="glib-File-Utilities.html#GFileTest" title="enum GFileTest"><span class="type">GFileTest</span></a> test</code></em>);</pre>
609 <p>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>
610  are
611 <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 | G_FILE_TEST_IS_DIR)</code>
612 will return <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the file exists; the check whether it's a
613 directory doesn't matter since the existence test is <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>. With
614 the current set of available tests, there's no point passing in
615 more than one test at a time.</p>
616 <p>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,
617 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
618 <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>.</p>
619 <p>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.</p>
621 <p>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
622 to perform an operation, because there is always the possibility
623 of the condition changing before you actually perform the operation.
624 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>
625 to know whether it is safe to write to a file without being
626 tricked into writing into a different location. It doesn't work!</p>
627 <div class="informalexample">
628   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
629     <tbody>
630       <tr>
631         <td class="listing_lines" align="right"><pre>1
632 2
633 3
634 4
635 5
636 6</pre></td>
637         <td class="listing_code"><pre class="programlisting"><span class="gtkdoc slc">// DON&apos;T DO THIS</span>
638 <span class="keyword">if</span> <span class="gtkdoc opt">(!</span><span class="function"><a href="glib-File-Utilities.html#g-file-test">g_file_test</a></span> <span class="gtkdoc opt">(</span>filename<span class="gtkdoc opt">,</span> G_FILE_TEST_IS_SYMLINK<span class="gtkdoc opt">))</span> 
639   <span class="gtkdoc opt">{</span>
640     fd <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-File-Utilities.html#g-open">g_open</a></span> <span class="gtkdoc opt">(</span>filename<span class="gtkdoc opt">,</span> O_WRONLY<span class="gtkdoc opt">);</span>
641     <span class="gtkdoc slc">// write to fd</span>
642   <span class="gtkdoc opt">}</span></pre></td>
643       </tr>
644     </tbody>
645   </table>
646 </div>
647
648 <p></p>
649 <p>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
650 <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>
651 system call. This usually doesn't matter, but if your program
652 is setuid or setgid it means that these tests will give you
653 the answer for the real user ID and group ID, rather than the
654 effective user ID and group ID.</p>
655 <p>On Windows, there are no symlinks, so testing for
656 <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
657 <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
658 its name indicates that it is executable, checking for well-known
659 extensions and those listed in the <code class="literal">PATHEXT</code> environment variable.</p>
660 <div class="refsect3">
661 <a name="g-file-test.parameters"></a><h4>Parameters</h4>
662 <div class="informaltable"><table class="informaltable" width="100%" border="0">
663 <colgroup>
664 <col width="150px" class="parameters_name">
665 <col class="parameters_description">
666 <col width="200px" class="parameters_annotations">
667 </colgroup>
668 <tbody>
669 <tr>
670 <td class="parameter_name"><p>filename</p></td>
671 <td class="parameter_description"><p> a filename to test in the
672 GLib file name encoding. </p></td>
673 <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename]</span></td>
674 </tr>
675 <tr>
676 <td class="parameter_name"><p>test</p></td>
677 <td class="parameter_description"><p>bitfield of <a class="link" href="glib-File-Utilities.html#GFileTest" title="enum GFileTest"><span class="type">GFileTest</span></a> flags</p></td>
678 <td class="parameter_annotations"> </td>
679 </tr>
680 </tbody>
681 </table></div>
682 </div>
683 <div class="refsect3">
684 <a name="g-file-test.returns"></a><h4>Returns</h4>
685 <p> whether a test was <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a></p>
686 </div>
687 </div>
688 <hr>
689 <div class="refsect2">
690 <a name="g-mkstemp"></a><h3>g_mkstemp ()</h3>
691 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
692 g_mkstemp (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *tmpl</code></em>);</pre>
693 <p>Opens a temporary file. See the <code class="function">mkstemp()</code> documentation
694 on most UNIX-like systems.</p>
695 <p>The parameter is a string that should follow the rules for
696 <code class="function">mkstemp()</code> templates, i.e. contain the string "XXXXXX".
697 <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> in that the
698 sequence does not have to occur at the very end of the template.
699 The X string will be modified to form the name of a file that
700 didn't exist. The string should be in the GLib file name encoding.
701 Most importantly, on Windows it should be in UTF-8.</p>
702 <div class="refsect3">
703 <a name="g-mkstemp.parameters"></a><h4>Parameters</h4>
704 <div class="informaltable"><table class="informaltable" width="100%" border="0">
705 <colgroup>
706 <col width="150px" class="parameters_name">
707 <col class="parameters_description">
708 <col width="200px" class="parameters_annotations">
709 </colgroup>
710 <tbody><tr>
711 <td class="parameter_name"><p>tmpl</p></td>
712 <td class="parameter_description"><p> template filename. </p></td>
713 <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename]</span></td>
714 </tr></tbody>
715 </table></div>
716 </div>
717 <div class="refsect3">
718 <a name="g-mkstemp.returns"></a><h4>Returns</h4>
719 <p> A file handle (as from <code class="function">open()</code>) to the file
720 opened for reading and writing. The file is opened in binary
721 mode on platforms where there is a difference. The file handle
722 should be closed with <code class="function">close()</code>. In case of errors, -1 is
723 returned and <code class="literal">errno</code> will be set.</p>
724 </div>
725 </div>
726 <hr>
727 <div class="refsect2">
728 <a name="g-mkstemp-full"></a><h3>g_mkstemp_full ()</h3>
729 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
730 g_mkstemp_full (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *tmpl</code></em>,
731                 <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="type">gint</span></a> flags</code></em>,
732                 <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="type">gint</span></a> mode</code></em>);</pre>
733 <p>Opens a temporary file. See the <code class="function">mkstemp()</code> documentation
734 on most UNIX-like systems.</p>
735 <p>The parameter is a string that should follow the rules for
736 <code class="function">mkstemp()</code> templates, i.e. contain the string "XXXXXX".
737 <a class="link" href="glib-File-Utilities.html#g-mkstemp-full" title="g_mkstemp_full ()"><code class="function">g_mkstemp_full()</code></a> is slightly more flexible than <code class="function">mkstemp()</code>
738 in that the sequence does not have to occur at the very end of the
739 template and you can pass a <em class="parameter"><code>mode</code></em>
740  and additional <em class="parameter"><code>flags</code></em>
741 . The X
742 string will be modified to form the name of a file that didn't exist.
743 The string should be in the GLib file name encoding. Most importantly,
744 on Windows it should be in UTF-8.</p>
745 <div class="refsect3">
746 <a name="g-mkstemp-full.parameters"></a><h4>Parameters</h4>
747 <div class="informaltable"><table class="informaltable" width="100%" border="0">
748 <colgroup>
749 <col width="150px" class="parameters_name">
750 <col class="parameters_description">
751 <col width="200px" class="parameters_annotations">
752 </colgroup>
753 <tbody>
754 <tr>
755 <td class="parameter_name"><p>tmpl</p></td>
756 <td class="parameter_description"><p> template filename. </p></td>
757 <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename]</span></td>
758 </tr>
759 <tr>
760 <td class="parameter_name"><p>flags</p></td>
761 <td class="parameter_description"><p>flags to pass to an <code class="function">open()</code> call in addition to O_EXCL
762 and O_CREAT, which are passed automatically</p></td>
763 <td class="parameter_annotations"> </td>
764 </tr>
765 <tr>
766 <td class="parameter_name"><p>mode</p></td>
767 <td class="parameter_description"><p>permissions to create the temporary file with</p></td>
768 <td class="parameter_annotations"> </td>
769 </tr>
770 </tbody>
771 </table></div>
772 </div>
773 <div class="refsect3">
774 <a name="g-mkstemp-full.returns"></a><h4>Returns</h4>
775 <p> A file handle (as from <code class="function">open()</code>) to the file
776 opened for reading and writing. The file handle should be
777 closed with <code class="function">close()</code>. In case of errors, -1 is returned
778 and <code class="literal">errno</code> will be set.</p>
779 </div>
780 <p class="since">Since: <a class="link" href="api-index-2-22.html#api-index-2.22">2.22</a></p>
781 </div>
782 <hr>
783 <div class="refsect2">
784 <a name="g-file-open-tmp"></a><h3>g_file_open_tmp ()</h3>
785 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
786 g_file_open_tmp (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *tmpl</code></em>,
787                  <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> **name_used</code></em>,
788                  <em class="parameter"><code><a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> **error</code></em>);</pre>
789 <p>Opens a file for writing in the preferred directory for temporary
790 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>).</p>
791 <p><em class="parameter"><code>tmpl</code></em>
792  should be a string in the GLib file name encoding containing
793 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>.
794 However, unlike these functions, the template should only be a
795 basename, no directory components are allowed. If template is
796 <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>, a default template is used.</p>
797 <p>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>) <em class="parameter"><code>tmpl</code></em>
798  is not
799 modified, and might thus be a read-only literal string.</p>
800 <p>Upon success, and if <em class="parameter"><code>name_used</code></em>
801  is non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>, the actual name used
802 is returned in <em class="parameter"><code>name_used</code></em>
803 . This 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>
804 when not needed any longer. The returned name is in the GLib file
805 name encoding.</p>
806 <div class="refsect3">
807 <a name="g-file-open-tmp.parameters"></a><h4>Parameters</h4>
808 <div class="informaltable"><table class="informaltable" width="100%" border="0">
809 <colgroup>
810 <col width="150px" class="parameters_name">
811 <col class="parameters_description">
812 <col width="200px" class="parameters_annotations">
813 </colgroup>
814 <tbody>
815 <tr>
816 <td class="parameter_name"><p>tmpl</p></td>
817 <td class="parameter_description"><p> Template for file name, as in
818 <a class="link" href="glib-File-Utilities.html#g-mkstemp" title="g_mkstemp ()"><code class="function">g_mkstemp()</code></a>, basename only, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> for a default template. </p></td>
819 <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
820 </tr>
821 <tr>
822 <td class="parameter_name"><p>name_used</p></td>
823 <td class="parameter_description"><p> location to store actual name used,
824 or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. </p></td>
825 <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename]</span></td>
826 </tr>
827 <tr>
828 <td class="parameter_name"><p>error</p></td>
829 <td class="parameter_description"><p>return location for a <a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a></p></td>
830 <td class="parameter_annotations"> </td>
831 </tr>
832 </tbody>
833 </table></div>
834 </div>
835 <div class="refsect3">
836 <a name="g-file-open-tmp.returns"></a><h4>Returns</h4>
837 <p> A file handle (as from <code class="function">open()</code>) to the file opened for
838 reading and writing. The file is opened in binary mode on platforms
839 where there is a difference. The file handle should be closed with
840 <code class="function">close()</code>. In case of errors, -1 is returned and <em class="parameter"><code>error</code></em>
841 will be set.</p>
842 </div>
843 </div>
844 <hr>
845 <div class="refsect2">
846 <a name="g-file-read-link"></a><h3>g_file_read_link ()</h3>
847 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
848 g_file_read_link (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *filename</code></em>,
849                   <em class="parameter"><code><a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> **error</code></em>);</pre>
850 <p>Reads the contents of the symbolic link <em class="parameter"><code>filename</code></em>
851  like the POSIX
852 <code class="function">readlink()</code> function.  The returned string is in the encoding used
853 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>
854 <div class="refsect3">
855 <a name="g-file-read-link.parameters"></a><h4>Parameters</h4>
856 <div class="informaltable"><table class="informaltable" width="100%" border="0">
857 <colgroup>
858 <col width="150px" class="parameters_name">
859 <col class="parameters_description">
860 <col width="200px" class="parameters_annotations">
861 </colgroup>
862 <tbody>
863 <tr>
864 <td class="parameter_name"><p>filename</p></td>
865 <td class="parameter_description"><p> the symbolic link. </p></td>
866 <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename]</span></td>
867 </tr>
868 <tr>
869 <td class="parameter_name"><p>error</p></td>
870 <td class="parameter_description"><p>return location for a <a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a></p></td>
871 <td class="parameter_annotations"> </td>
872 </tr>
873 </tbody>
874 </table></div>
875 </div>
876 <div class="refsect3">
877 <a name="g-file-read-link.returns"></a><h4>Returns</h4>
878 <p> A newly-allocated string with the contents of
879 the symbolic link, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if an error occurred. </p>
880 <p><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename]</span></p>
881 </div>
882 <p class="since">Since: <a class="link" href="api-index-2-4.html#api-index-2.4">2.4</a></p>
883 </div>
884 <hr>
885 <div class="refsect2">
886 <a name="g-mkdir-with-parents"></a><h3>g_mkdir_with_parents ()</h3>
887 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
888 g_mkdir_with_parents (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *pathname</code></em>,
889                       <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="type">gint</span></a> mode</code></em>);</pre>
890 <p>Create a directory if it doesn't already exist. Create intermediate
891 parent directories as needed, too.</p>
892 <div class="refsect3">
893 <a name="g-mkdir-with-parents.parameters"></a><h4>Parameters</h4>
894 <div class="informaltable"><table class="informaltable" width="100%" border="0">
895 <colgroup>
896 <col width="150px" class="parameters_name">
897 <col class="parameters_description">
898 <col width="200px" class="parameters_annotations">
899 </colgroup>
900 <tbody>
901 <tr>
902 <td class="parameter_name"><p>pathname</p></td>
903 <td class="parameter_description"><p> a pathname in the GLib file name encoding. </p></td>
904 <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename]</span></td>
905 </tr>
906 <tr>
907 <td class="parameter_name"><p>mode</p></td>
908 <td class="parameter_description"><p>permissions to use for newly created directories</p></td>
909 <td class="parameter_annotations"> </td>
910 </tr>
911 </tbody>
912 </table></div>
913 </div>
914 <div class="refsect3">
915 <a name="g-mkdir-with-parents.returns"></a><h4>Returns</h4>
916 <p> 0 if the directory already exists, or was successfully
917 created. Returns -1 if an error occurred, with errno set.</p>
918 </div>
919 <p class="since">Since: <a class="link" href="api-index-2-8.html#api-index-2.8">2.8</a></p>
920 </div>
921 <hr>
922 <div class="refsect2">
923 <a name="g-mkdtemp"></a><h3>g_mkdtemp ()</h3>
924 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
925 g_mkdtemp (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *tmpl</code></em>);</pre>
926 <p>Creates a temporary directory. See the <code class="function">mkdtemp()</code> documentation
927 on most UNIX-like systems.</p>
928 <p>The parameter is a string that should follow the rules for
929 <code class="function">mkdtemp()</code> templates, i.e. contain the string "XXXXXX".
930 <a class="link" href="glib-File-Utilities.html#g-mkdtemp" title="g_mkdtemp ()"><code class="function">g_mkdtemp()</code></a> is slightly more flexible than <code class="function">mkdtemp()</code> in that the
931 sequence does not have to occur at the very end of the template
932 and you can pass a <em class="parameter"><code>mode</code></em>
933  and additional <em class="parameter"><code>flags</code></em>
934 . The X string will
935 be modified to form the name of a directory that didn't exist.
936 The string should be in the GLib file name encoding. Most importantly,
937 on Windows it should be in UTF-8.</p>
938 <div class="refsect3">
939 <a name="g-mkdtemp.parameters"></a><h4>Parameters</h4>
940 <div class="informaltable"><table class="informaltable" width="100%" border="0">
941 <colgroup>
942 <col width="150px" class="parameters_name">
943 <col class="parameters_description">
944 <col width="200px" class="parameters_annotations">
945 </colgroup>
946 <tbody><tr>
947 <td class="parameter_name"><p>tmpl</p></td>
948 <td class="parameter_description"><p> template directory name. </p></td>
949 <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename]</span></td>
950 </tr></tbody>
951 </table></div>
952 </div>
953 <div class="refsect3">
954 <a name="g-mkdtemp.returns"></a><h4>Returns</h4>
955 <p> A pointer to <em class="parameter"><code>tmpl</code></em>
956 , which has been
957 modified to hold the directory name.  In case of errors, <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> is
958 returned and <code class="literal">errno</code> will be set. </p>
959 <p><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>][<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename]</span></p>
960 </div>
961 <p class="since">Since: <a class="link" href="api-index-2-30.html#api-index-2.30">2.30</a></p>
962 </div>
963 <hr>
964 <div class="refsect2">
965 <a name="g-mkdtemp-full"></a><h3>g_mkdtemp_full ()</h3>
966 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
967 g_mkdtemp_full (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *tmpl</code></em>,
968                 <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="type">gint</span></a> mode</code></em>);</pre>
969 <p>Creates a temporary directory. See the <code class="function">mkdtemp()</code> documentation
970 on most UNIX-like systems.</p>
971 <p>The parameter is a string that should follow the rules for
972 <code class="function">mkdtemp()</code> templates, i.e. contain the string "XXXXXX".
973 <a class="link" href="glib-File-Utilities.html#g-mkdtemp" title="g_mkdtemp ()"><code class="function">g_mkdtemp()</code></a> is slightly more flexible than <code class="function">mkdtemp()</code> in that the
974 sequence does not have to occur at the very end of the template
975 and you can pass a <em class="parameter"><code>mode</code></em>
976 . The X string will be modified to form
977 the name of a directory that didn't exist. The string should be
978 in the GLib file name encoding. Most importantly, on Windows it
979 should be in UTF-8.</p>
980 <div class="refsect3">
981 <a name="g-mkdtemp-full.parameters"></a><h4>Parameters</h4>
982 <div class="informaltable"><table class="informaltable" width="100%" border="0">
983 <colgroup>
984 <col width="150px" class="parameters_name">
985 <col class="parameters_description">
986 <col width="200px" class="parameters_annotations">
987 </colgroup>
988 <tbody>
989 <tr>
990 <td class="parameter_name"><p>tmpl</p></td>
991 <td class="parameter_description"><p> template directory name. </p></td>
992 <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename]</span></td>
993 </tr>
994 <tr>
995 <td class="parameter_name"><p>mode</p></td>
996 <td class="parameter_description"><p>permissions to create the temporary directory with</p></td>
997 <td class="parameter_annotations"> </td>
998 </tr>
999 </tbody>
1000 </table></div>
1001 </div>
1002 <div class="refsect3">
1003 <a name="g-mkdtemp-full.returns"></a><h4>Returns</h4>
1004 <p> A pointer to <em class="parameter"><code>tmpl</code></em>
1005 , which has been
1006 modified to hold the directory name. In case of errors, <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> is
1007 returned, and <code class="literal">errno</code> will be set. </p>
1008 <p><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>][<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename]</span></p>
1009 </div>
1010 <p class="since">Since: <a class="link" href="api-index-2-30.html#api-index-2.30">2.30</a></p>
1011 </div>
1012 <hr>
1013 <div class="refsect2">
1014 <a name="g-dir-make-tmp"></a><h3>g_dir_make_tmp ()</h3>
1015 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
1016 g_dir_make_tmp (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *tmpl</code></em>,
1017                 <em class="parameter"><code><a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> **error</code></em>);</pre>
1018 <p>Creates a subdirectory in the preferred directory for temporary
1019 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>).</p>
1020 <p><em class="parameter"><code>tmpl</code></em>
1021  should be a string in the GLib file name encoding containing
1022 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>.
1023 However, unlike these functions, the template should only be a
1024 basename, no directory components are allowed. If template is
1025 <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>, a default template is used.</p>
1026 <p>Note that in contrast to <a class="link" href="glib-File-Utilities.html#g-mkdtemp" title="g_mkdtemp ()"><code class="function">g_mkdtemp()</code></a> (and <code class="function">mkdtemp()</code>) <em class="parameter"><code>tmpl</code></em>
1027  is not
1028 modified, and might thus be a read-only literal string.</p>
1029 <div class="refsect3">
1030 <a name="g-dir-make-tmp.parameters"></a><h4>Parameters</h4>
1031 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1032 <colgroup>
1033 <col width="150px" class="parameters_name">
1034 <col class="parameters_description">
1035 <col width="200px" class="parameters_annotations">
1036 </colgroup>
1037 <tbody>
1038 <tr>
1039 <td class="parameter_name"><p>tmpl</p></td>
1040 <td class="parameter_description"><p> Template for directory name,
1041 as in <a class="link" href="glib-File-Utilities.html#g-mkdtemp" title="g_mkdtemp ()"><code class="function">g_mkdtemp()</code></a>, basename only, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> for a default template. </p></td>
1042 <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
1043 </tr>
1044 <tr>
1045 <td class="parameter_name"><p>error</p></td>
1046 <td class="parameter_description"><p>return location for a <a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a></p></td>
1047 <td class="parameter_annotations"> </td>
1048 </tr>
1049 </tbody>
1050 </table></div>
1051 </div>
1052 <div class="refsect3">
1053 <a name="g-dir-make-tmp.returns"></a><h4>Returns</h4>
1054 <p> The actual name used. This string
1055 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 and is
1056 is in the GLib file name encoding. In case of errors, <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> is
1057 returned and <em class="parameter"><code>error</code></em>
1058 will be set. </p>
1059 <p><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename]</span></p>
1060 </div>
1061 <p class="since">Since: <a class="link" href="api-index-2-30.html#api-index-2.30">2.30</a></p>
1062 </div>
1063 <hr>
1064 <div class="refsect2">
1065 <a name="g-dir-open"></a><h3>g_dir_open ()</h3>
1066 <pre class="programlisting"><a class="link" href="glib-File-Utilities.html#GDir" title="GDir"><span class="returnvalue">GDir</span></a> *
1067 g_dir_open (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *path</code></em>,
1068             <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint" title="guint ()"><span class="type">guint</span></a> flags</code></em>,
1069             <em class="parameter"><code><a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> **error</code></em>);</pre>
1070 <p>Opens a directory for reading. The names of the files in the
1071 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>.  Note
1072 that the ordering is not defined.</p>
1073 <div class="refsect3">
1074 <a name="g-dir-open.parameters"></a><h4>Parameters</h4>
1075 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1076 <colgroup>
1077 <col width="150px" class="parameters_name">
1078 <col class="parameters_description">
1079 <col width="200px" class="parameters_annotations">
1080 </colgroup>
1081 <tbody>
1082 <tr>
1083 <td class="parameter_name"><p>path</p></td>
1084 <td class="parameter_description"><p>the path to the directory you are interested in. On Unix
1085 in the on-disk encoding. On Windows in UTF-8</p></td>
1086 <td class="parameter_annotations"> </td>
1087 </tr>
1088 <tr>
1089 <td class="parameter_name"><p>flags</p></td>
1090 <td class="parameter_description"><p>Currently must be set to 0. Reserved for future use.</p></td>
1091 <td class="parameter_annotations"> </td>
1092 </tr>
1093 <tr>
1094 <td class="parameter_name"><p>error</p></td>
1095 <td class="parameter_description"><p>return location for a <a class="link" href="glib-Error-Reporting.html#GError" title="struct 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>.
1096 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
1097 <a class="link" href="glib-File-Utilities.html#g-dir-open" title="g_dir_open ()"><code class="function">g_dir_open()</code></a> fails.</p></td>
1098 <td class="parameter_annotations"> </td>
1099 </tr>
1100 </tbody>
1101 </table></div>
1102 </div>
1103 <div class="refsect3">
1104 <a name="g-dir-open.returns"></a><h4>Returns</h4>
1105 <p> 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.
1106 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>
1107 when you are finished with it.</p>
1108 </div>
1109 </div>
1110 <hr>
1111 <div class="refsect2">
1112 <a name="g-dir-read-name"></a><h3>g_dir_read_name ()</h3>
1113 <pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
1114 g_dir_read_name (<em class="parameter"><code><a class="link" href="glib-File-Utilities.html#GDir" title="GDir"><span class="type">GDir</span></a> *dir</code></em>);</pre>
1115 <p>Retrieves the name of another entry in the directory, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>.
1116 The order of entries returned from this function is not defined,
1117 and may vary by file system or other operating-system dependent
1118 factors.</p>
1119 <p><a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> may also be returned in case of errors. On Unix, you can
1120 check <code class="literal">errno</code> to find out if <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> was returned because of an error.</p>
1121 <p>On Unix, the '.' and '..' entries are omitted, and the returned
1122 name is in the on-disk encoding.</p>
1123 <p>On Windows, as is true of all GLib functions which operate on
1124 filenames, the returned name is in UTF-8.</p>
1125 <div class="refsect3">
1126 <a name="g-dir-read-name.parameters"></a><h4>Parameters</h4>
1127 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1128 <colgroup>
1129 <col width="150px" class="parameters_name">
1130 <col class="parameters_description">
1131 <col width="200px" class="parameters_annotations">
1132 </colgroup>
1133 <tbody><tr>
1134 <td class="parameter_name"><p>dir</p></td>
1135 <td class="parameter_description"><p>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></p></td>
1136 <td class="parameter_annotations"> </td>
1137 </tr></tbody>
1138 </table></div>
1139 </div>
1140 <div class="refsect3">
1141 <a name="g-dir-read-name.returns"></a><h4>Returns</h4>
1142 <p> 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
1143 more entries. The return value is owned by GLib and
1144 must not be modified or freed. </p>
1145 <p><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename]</span></p>
1146 </div>
1147 </div>
1148 <hr>
1149 <div class="refsect2">
1150 <a name="g-dir-rewind"></a><h3>g_dir_rewind ()</h3>
1151 <pre class="programlisting"><span class="returnvalue">void</span>
1152 g_dir_rewind (<em class="parameter"><code><a class="link" href="glib-File-Utilities.html#GDir" title="GDir"><span class="type">GDir</span></a> *dir</code></em>);</pre>
1153 <p>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>
1154 will return the first entry again.</p>
1155 <div class="refsect3">
1156 <a name="g-dir-rewind.parameters"></a><h4>Parameters</h4>
1157 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1158 <colgroup>
1159 <col width="150px" class="parameters_name">
1160 <col class="parameters_description">
1161 <col width="200px" class="parameters_annotations">
1162 </colgroup>
1163 <tbody><tr>
1164 <td class="parameter_name"><p>dir</p></td>
1165 <td class="parameter_description"><p>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></p></td>
1166 <td class="parameter_annotations"> </td>
1167 </tr></tbody>
1168 </table></div>
1169 </div>
1170 </div>
1171 <hr>
1172 <div class="refsect2">
1173 <a name="g-dir-close"></a><h3>g_dir_close ()</h3>
1174 <pre class="programlisting"><span class="returnvalue">void</span>
1175 g_dir_close (<em class="parameter"><code><a class="link" href="glib-File-Utilities.html#GDir" title="GDir"><span class="type">GDir</span></a> *dir</code></em>);</pre>
1176 <p>Closes the directory and deallocates all related resources.</p>
1177 <div class="refsect3">
1178 <a name="g-dir-close.parameters"></a><h4>Parameters</h4>
1179 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1180 <colgroup>
1181 <col width="150px" class="parameters_name">
1182 <col class="parameters_description">
1183 <col width="200px" class="parameters_annotations">
1184 </colgroup>
1185 <tbody><tr>
1186 <td class="parameter_name"><p>dir</p></td>
1187 <td class="parameter_description"><p>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></p></td>
1188 <td class="parameter_annotations"> </td>
1189 </tr></tbody>
1190 </table></div>
1191 </div>
1192 </div>
1193 <hr>
1194 <div class="refsect2">
1195 <a name="g-mapped-file-new"></a><h3>g_mapped_file_new ()</h3>
1196 <pre class="programlisting"><a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="returnvalue">GMappedFile</span></a> *
1197 g_mapped_file_new (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *filename</code></em>,
1198                    <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="type">gboolean</span></a> writable</code></em>,
1199                    <em class="parameter"><code><a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> **error</code></em>);</pre>
1200 <p>Maps a file into memory. On UNIX, this is using the <code class="function">mmap()</code> function.</p>
1201 <p>If <em class="parameter"><code>writable</code></em>
1202  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
1203 it is an error to modify the mapped buffer. Modifications to the buffer
1204 are not visible to other processes mapping the same file, and are not
1205 written back to the file.</p>
1206 <p>Note that modifications of the underlying file might affect the contents
1207 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
1208 will not be modified, or if all modifications of the file are done
1209 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>
1210 <p>If <em class="parameter"><code>filename</code></em>
1211  is the name of an empty, regular file, the function
1212 will successfully return an empty <a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="type">GMappedFile</span></a>. In other cases of
1213 size 0 (e.g. device files such as /dev/null), <em class="parameter"><code>error</code></em>
1214  will be set
1215 to the <a class="link" href="glib-File-Utilities.html#GFileError" title="enum GFileError"><span class="type">GFileError</span></a> value <a class="link" href="glib-File-Utilities.html#G-FILE-ERROR-INVAL:CAPS"><span class="type">G_FILE_ERROR_INVAL</span></a>.</p>
1216 <div class="refsect3">
1217 <a name="g-mapped-file-new.parameters"></a><h4>Parameters</h4>
1218 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1219 <colgroup>
1220 <col width="150px" class="parameters_name">
1221 <col class="parameters_description">
1222 <col width="200px" class="parameters_annotations">
1223 </colgroup>
1224 <tbody>
1225 <tr>
1226 <td class="parameter_name"><p>filename</p></td>
1227 <td class="parameter_description"><p> The path of the file to load, in the GLib
1228 filename encoding. </p></td>
1229 <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename]</span></td>
1230 </tr>
1231 <tr>
1232 <td class="parameter_name"><p>writable</p></td>
1233 <td class="parameter_description"><p>whether the mapping should be writable</p></td>
1234 <td class="parameter_annotations"> </td>
1235 </tr>
1236 <tr>
1237 <td class="parameter_name"><p>error</p></td>
1238 <td class="parameter_description"><p>return location for a <a class="link" href="glib-Error-Reporting.html#GError" title="struct 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></p></td>
1239 <td class="parameter_annotations"> </td>
1240 </tr>
1241 </tbody>
1242 </table></div>
1243 </div>
1244 <div class="refsect3">
1245 <a name="g-mapped-file-new.returns"></a><h4>Returns</h4>
1246 <p> a newly allocated <a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="type">GMappedFile</span></a> which must be unref'd
1247 with <a class="link" href="glib-File-Utilities.html#g-mapped-file-unref" title="g_mapped_file_unref ()"><code class="function">g_mapped_file_unref()</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.</p>
1248 </div>
1249 <p class="since">Since: <a class="link" href="api-index-2-8.html#api-index-2.8">2.8</a></p>
1250 </div>
1251 <hr>
1252 <div class="refsect2">
1253 <a name="g-mapped-file-new-from-fd"></a><h3>g_mapped_file_new_from_fd ()</h3>
1254 <pre class="programlisting"><a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="returnvalue">GMappedFile</span></a> *
1255 g_mapped_file_new_from_fd (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="type">gint</span></a> fd</code></em>,
1256                            <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="type">gboolean</span></a> writable</code></em>,
1257                            <em class="parameter"><code><a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> **error</code></em>);</pre>
1258 <p>Maps a file into memory. On UNIX, this is using the <code class="function">mmap()</code> function.</p>
1259 <p>If <em class="parameter"><code>writable</code></em>
1260  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
1261 it is an error to modify the mapped buffer. Modifications to the buffer
1262 are not visible to other processes mapping the same file, and are not
1263 written back to the file.</p>
1264 <p>Note that modifications of the underlying file might affect the contents
1265 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
1266 will not be modified, or if all modifications of the file are done
1267 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>
1268 <div class="refsect3">
1269 <a name="g-mapped-file-new-from-fd.parameters"></a><h4>Parameters</h4>
1270 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1271 <colgroup>
1272 <col width="150px" class="parameters_name">
1273 <col class="parameters_description">
1274 <col width="200px" class="parameters_annotations">
1275 </colgroup>
1276 <tbody>
1277 <tr>
1278 <td class="parameter_name"><p>fd</p></td>
1279 <td class="parameter_description"><p>The file descriptor of the file to load</p></td>
1280 <td class="parameter_annotations"> </td>
1281 </tr>
1282 <tr>
1283 <td class="parameter_name"><p>writable</p></td>
1284 <td class="parameter_description"><p>whether the mapping should be writable</p></td>
1285 <td class="parameter_annotations"> </td>
1286 </tr>
1287 <tr>
1288 <td class="parameter_name"><p>error</p></td>
1289 <td class="parameter_description"><p>return location for a <a class="link" href="glib-Error-Reporting.html#GError" title="struct 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></p></td>
1290 <td class="parameter_annotations"> </td>
1291 </tr>
1292 </tbody>
1293 </table></div>
1294 </div>
1295 <div class="refsect3">
1296 <a name="g-mapped-file-new-from-fd.returns"></a><h4>Returns</h4>
1297 <p> a newly allocated <a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="type">GMappedFile</span></a> which must be unref'd
1298 with <a class="link" href="glib-File-Utilities.html#g-mapped-file-unref" title="g_mapped_file_unref ()"><code class="function">g_mapped_file_unref()</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.</p>
1299 </div>
1300 <p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p>
1301 </div>
1302 <hr>
1303 <div class="refsect2">
1304 <a name="g-mapped-file-ref"></a><h3>g_mapped_file_ref ()</h3>
1305 <pre class="programlisting"><a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="returnvalue">GMappedFile</span></a> *
1306 g_mapped_file_ref (<em class="parameter"><code><a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="type">GMappedFile</span></a> *file</code></em>);</pre>
1307 <p>Increments the reference count of <em class="parameter"><code>file</code></em>
1308  by one.  It is safe to call
1309 this function from any thread.</p>
1310 <div class="refsect3">
1311 <a name="g-mapped-file-ref.parameters"></a><h4>Parameters</h4>
1312 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1313 <colgroup>
1314 <col width="150px" class="parameters_name">
1315 <col class="parameters_description">
1316 <col width="200px" class="parameters_annotations">
1317 </colgroup>
1318 <tbody><tr>
1319 <td class="parameter_name"><p>file</p></td>
1320 <td class="parameter_description"><p>a <a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="type">GMappedFile</span></a></p></td>
1321 <td class="parameter_annotations"> </td>
1322 </tr></tbody>
1323 </table></div>
1324 </div>
1325 <div class="refsect3">
1326 <a name="g-mapped-file-ref.returns"></a><h4>Returns</h4>
1327 <p> the passed in <a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="type">GMappedFile</span></a>.</p>
1328 </div>
1329 <p class="since">Since: <a class="link" href="api-index-2-22.html#api-index-2.22">2.22</a></p>
1330 </div>
1331 <hr>
1332 <div class="refsect2">
1333 <a name="g-mapped-file-unref"></a><h3>g_mapped_file_unref ()</h3>
1334 <pre class="programlisting"><span class="returnvalue">void</span>
1335 g_mapped_file_unref (<em class="parameter"><code><a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="type">GMappedFile</span></a> *file</code></em>);</pre>
1336 <p>Decrements the reference count of <em class="parameter"><code>file</code></em>
1337  by one.  If the reference count
1338 drops to 0, unmaps the buffer of <em class="parameter"><code>file</code></em>
1339  and frees it.</p>
1340 <p>It is safe to call this function from any thread.</p>
1341 <p>Since 2.22</p>
1342 <div class="refsect3">
1343 <a name="g-mapped-file-unref.parameters"></a><h4>Parameters</h4>
1344 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1345 <colgroup>
1346 <col width="150px" class="parameters_name">
1347 <col class="parameters_description">
1348 <col width="200px" class="parameters_annotations">
1349 </colgroup>
1350 <tbody><tr>
1351 <td class="parameter_name"><p>file</p></td>
1352 <td class="parameter_description"><p>a <a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="type">GMappedFile</span></a></p></td>
1353 <td class="parameter_annotations"> </td>
1354 </tr></tbody>
1355 </table></div>
1356 </div>
1357 </div>
1358 <hr>
1359 <div class="refsect2">
1360 <a name="g-mapped-file-free"></a><h3>g_mapped_file_free ()</h3>
1361 <pre class="programlisting"><span class="returnvalue">void</span>
1362 g_mapped_file_free (<em class="parameter"><code><a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="type">GMappedFile</span></a> *file</code></em>);</pre>
1363 <div class="warning">
1364 <p><code class="literal">g_mapped_file_free</code> has been deprecated since version 2.22 and should not be used in newly-written code.</p>
1365 <p>Use <a class="link" href="glib-File-Utilities.html#g-mapped-file-unref" title="g_mapped_file_unref ()"><code class="function">g_mapped_file_unref()</code></a> instead.</p>
1366 </div>
1367 <p>This call existed before <a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="type">GMappedFile</span></a> had refcounting and is currently
1368 exactly the same as <a class="link" href="glib-File-Utilities.html#g-mapped-file-unref" title="g_mapped_file_unref ()"><code class="function">g_mapped_file_unref()</code></a>.</p>
1369 <div class="refsect3">
1370 <a name="g-mapped-file-free.parameters"></a><h4>Parameters</h4>
1371 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1372 <colgroup>
1373 <col width="150px" class="parameters_name">
1374 <col class="parameters_description">
1375 <col width="200px" class="parameters_annotations">
1376 </colgroup>
1377 <tbody><tr>
1378 <td class="parameter_name"><p>file</p></td>
1379 <td class="parameter_description"><p>a <a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="type">GMappedFile</span></a></p></td>
1380 <td class="parameter_annotations"> </td>
1381 </tr></tbody>
1382 </table></div>
1383 </div>
1384 <p class="since">Since: <a class="link" href="api-index-2-8.html#api-index-2.8">2.8</a></p>
1385 </div>
1386 <hr>
1387 <div class="refsect2">
1388 <a name="g-mapped-file-get-length"></a><h3>g_mapped_file_get_length ()</h3>
1389 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a>
1390 g_mapped_file_get_length (<em class="parameter"><code><a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="type">GMappedFile</span></a> *file</code></em>);</pre>
1391 <p>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>
1392 <div class="refsect3">
1393 <a name="g-mapped-file-get-length.parameters"></a><h4>Parameters</h4>
1394 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1395 <colgroup>
1396 <col width="150px" class="parameters_name">
1397 <col class="parameters_description">
1398 <col width="200px" class="parameters_annotations">
1399 </colgroup>
1400 <tbody><tr>
1401 <td class="parameter_name"><p>file</p></td>
1402 <td class="parameter_description"><p>a <a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="type">GMappedFile</span></a></p></td>
1403 <td class="parameter_annotations"> </td>
1404 </tr></tbody>
1405 </table></div>
1406 </div>
1407 <div class="refsect3">
1408 <a name="g-mapped-file-get-length.returns"></a><h4>Returns</h4>
1409 <p> the length of the contents of <em class="parameter"><code>file</code></em>
1410 .</p>
1411 </div>
1412 <p class="since">Since: <a class="link" href="api-index-2-8.html#api-index-2.8">2.8</a></p>
1413 </div>
1414 <hr>
1415 <div class="refsect2">
1416 <a name="g-mapped-file-get-contents"></a><h3>g_mapped_file_get_contents ()</h3>
1417 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
1418 g_mapped_file_get_contents (<em class="parameter"><code><a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="type">GMappedFile</span></a> *file</code></em>);</pre>
1419 <p>Returns the contents of a <a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="type">GMappedFile</span></a>. </p>
1420 <p>Note that the contents may not be zero-terminated,
1421 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>
1422 <p>If the file is empty then <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> is returned.</p>
1423 <div class="refsect3">
1424 <a name="g-mapped-file-get-contents.parameters"></a><h4>Parameters</h4>
1425 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1426 <colgroup>
1427 <col width="150px" class="parameters_name">
1428 <col class="parameters_description">
1429 <col width="200px" class="parameters_annotations">
1430 </colgroup>
1431 <tbody><tr>
1432 <td class="parameter_name"><p>file</p></td>
1433 <td class="parameter_description"><p>a <a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="type">GMappedFile</span></a></p></td>
1434 <td class="parameter_annotations"> </td>
1435 </tr></tbody>
1436 </table></div>
1437 </div>
1438 <div class="refsect3">
1439 <a name="g-mapped-file-get-contents.returns"></a><h4>Returns</h4>
1440 <p> the contents of <em class="parameter"><code>file</code></em>
1441 , or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>.</p>
1442 </div>
1443 <p class="since">Since: <a class="link" href="api-index-2-8.html#api-index-2.8">2.8</a></p>
1444 </div>
1445 <hr>
1446 <div class="refsect2">
1447 <a name="g-mapped-file-get-bytes"></a><h3>g_mapped_file_get_bytes ()</h3>
1448 <pre class="programlisting"><a class="link" href="glib-Byte-Arrays.html#GBytes" title="GBytes"><span class="returnvalue">GBytes</span></a> *
1449 g_mapped_file_get_bytes (<em class="parameter"><code><a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="type">GMappedFile</span></a> *file</code></em>);</pre>
1450 <p>Creates a new <a class="link" href="glib-Byte-Arrays.html#GBytes" title="GBytes"><span class="type">GBytes</span></a> which references the data mapped from <em class="parameter"><code>file</code></em>
1451 .
1452 The mapped contents of the file must not be modified after creating this
1453 bytes object, because a <a class="link" href="glib-Byte-Arrays.html#GBytes" title="GBytes"><span class="type">GBytes</span></a> should be immutable.</p>
1454 <div class="refsect3">
1455 <a name="g-mapped-file-get-bytes.parameters"></a><h4>Parameters</h4>
1456 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1457 <colgroup>
1458 <col width="150px" class="parameters_name">
1459 <col class="parameters_description">
1460 <col width="200px" class="parameters_annotations">
1461 </colgroup>
1462 <tbody><tr>
1463 <td class="parameter_name"><p>file</p></td>
1464 <td class="parameter_description"><p>a <a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="type">GMappedFile</span></a></p></td>
1465 <td class="parameter_annotations"> </td>
1466 </tr></tbody>
1467 </table></div>
1468 </div>
1469 <div class="refsect3">
1470 <a name="g-mapped-file-get-bytes.returns"></a><h4>Returns</h4>
1471 <p> A newly allocated <a class="link" href="glib-Byte-Arrays.html#GBytes" title="GBytes"><span class="type">GBytes</span></a> referencing data
1472 from <em class="parameter"><code>file</code></em>
1473 . </p>
1474 <p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
1475 </div>
1476 <p class="since">Since: <a class="link" href="api-index-2-34.html#api-index-2.34">2.34</a></p>
1477 </div>
1478 <hr>
1479 <div class="refsect2">
1480 <a name="g-open"></a><h3>g_open ()</h3>
1481 <pre class="programlisting"><span class="returnvalue">int</span>
1482 g_open (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *filename</code></em>,
1483         <em class="parameter"><code><span class="type">int</span> flags</code></em>,
1484         <em class="parameter"><code><span class="type">int</span> mode</code></em>);</pre>
1485 <p>A wrapper for the POSIX <code class="function">open()</code> function. The <code class="function">open()</code> function is
1486 used to convert a pathname into a file descriptor.</p>
1487 <p>On POSIX systems file descriptors are implemented by the operating
1488 system. On Windows, it's the C library that implements <code class="function">open()</code> and
1489 file descriptors. The actual Win32 API for opening files is quite
1490 different, see MSDN documentation for <code class="function">CreateFile()</code>. The Win32 API
1491 uses file handles, which are more randomish integers, not small
1492 integers like file descriptors.</p>
1493 <p>Because file descriptors are specific to the C library on Windows,
1494 the file descriptor returned by this function makes sense only to
1495 functions in the same C library. Thus if the GLib-using code uses a
1496 different C library than GLib does, the file descriptor returned by
1497 this function cannot be passed to C library functions like <code class="function">write()</code>
1498 or <code class="function">read()</code>.</p>
1499 <p>See your C library manual for more details about <code class="function">open()</code>.</p>
1500 <div class="refsect3">
1501 <a name="g-open.parameters"></a><h4>Parameters</h4>
1502 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1503 <colgroup>
1504 <col width="150px" class="parameters_name">
1505 <col class="parameters_description">
1506 <col width="200px" class="parameters_annotations">
1507 </colgroup>
1508 <tbody>
1509 <tr>
1510 <td class="parameter_name"><p>filename</p></td>
1511 <td class="parameter_description"><p> a pathname in the GLib file name encoding
1512 (UTF-8 on Windows). </p></td>
1513 <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename]</span></td>
1514 </tr>
1515 <tr>
1516 <td class="parameter_name"><p>flags</p></td>
1517 <td class="parameter_description"><p>as in <code class="function">open()</code></p></td>
1518 <td class="parameter_annotations"> </td>
1519 </tr>
1520 <tr>
1521 <td class="parameter_name"><p>mode</p></td>
1522 <td class="parameter_description"><p>as in <code class="function">open()</code></p></td>
1523 <td class="parameter_annotations"> </td>
1524 </tr>
1525 </tbody>
1526 </table></div>
1527 </div>
1528 <div class="refsect3">
1529 <a name="g-open.returns"></a><h4>Returns</h4>
1530 <p> a new file descriptor, or -1 if an error occurred.
1531 The return value can be used exactly like the return value
1532 from <code class="function">open()</code>.</p>
1533 </div>
1534 <p class="since">Since: <a class="link" href="api-index-2-6.html#api-index-2.6">2.6</a></p>
1535 </div>
1536 <hr>
1537 <div class="refsect2">
1538 <a name="g-rename"></a><h3>g_rename ()</h3>
1539 <pre class="programlisting"><span class="returnvalue">int</span>
1540 g_rename (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *oldfilename</code></em>,
1541           <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *newfilename</code></em>);</pre>
1542 <p>A wrapper for the POSIX <code class="function">rename()</code> function. The <code class="function">rename()</code> function 
1543 renames a file, moving it between directories if required.</p>
1544 <p>See your C library manual for more details about how <code class="function">rename()</code> works
1545 on your system. It is not possible in general on Windows to rename
1546 a file that is open to some process.</p>
1547 <div class="refsect3">
1548 <a name="g-rename.parameters"></a><h4>Parameters</h4>
1549 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1550 <colgroup>
1551 <col width="150px" class="parameters_name">
1552 <col class="parameters_description">
1553 <col width="200px" class="parameters_annotations">
1554 </colgroup>
1555 <tbody>
1556 <tr>
1557 <td class="parameter_name"><p>oldfilename</p></td>
1558 <td class="parameter_description"><p> a pathname in the GLib file name encoding
1559 (UTF-8 on Windows). </p></td>
1560 <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename]</span></td>
1561 </tr>
1562 <tr>
1563 <td class="parameter_name"><p>newfilename</p></td>
1564 <td class="parameter_description"><p> a pathname in the GLib file name encoding. </p></td>
1565 <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename]</span></td>
1566 </tr>
1567 </tbody>
1568 </table></div>
1569 </div>
1570 <div class="refsect3">
1571 <a name="g-rename.returns"></a><h4>Returns</h4>
1572 <p> 0 if the renaming succeeded, -1 if an error occurred</p>
1573 </div>
1574 <p class="since">Since: <a class="link" href="api-index-2-6.html#api-index-2.6">2.6</a></p>
1575 </div>
1576 <hr>
1577 <div class="refsect2">
1578 <a name="g-mkdir"></a><h3>g_mkdir ()</h3>
1579 <pre class="programlisting"><span class="returnvalue">int</span>
1580 g_mkdir (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *filename</code></em>,
1581          <em class="parameter"><code><span class="type">int</span> mode</code></em>);</pre>
1582 <p>A wrapper for the POSIX <code class="function">mkdir()</code> function. The <code class="function">mkdir()</code> function 
1583 attempts to create a directory with the given name and permissions.
1584 The mode argument is ignored on Windows.</p>
1585 <p>See your C library manual for more details about <code class="function">mkdir()</code>.</p>
1586 <div class="refsect3">
1587 <a name="g-mkdir.parameters"></a><h4>Parameters</h4>
1588 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1589 <colgroup>
1590 <col width="150px" class="parameters_name">
1591 <col class="parameters_description">
1592 <col width="200px" class="parameters_annotations">
1593 </colgroup>
1594 <tbody>
1595 <tr>
1596 <td class="parameter_name"><p>filename</p></td>
1597 <td class="parameter_description"><p> a pathname in the GLib file name encoding
1598 (UTF-8 on Windows). </p></td>
1599 <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename]</span></td>
1600 </tr>
1601 <tr>
1602 <td class="parameter_name"><p>mode</p></td>
1603 <td class="parameter_description"><p>permissions to use for the newly created directory</p></td>
1604 <td class="parameter_annotations"> </td>
1605 </tr>
1606 </tbody>
1607 </table></div>
1608 </div>
1609 <div class="refsect3">
1610 <a name="g-mkdir.returns"></a><h4>Returns</h4>
1611 <p> 0 if the directory was successfully created, -1 if an error
1612 occurred</p>
1613 </div>
1614 <p class="since">Since: <a class="link" href="api-index-2-6.html#api-index-2.6">2.6</a></p>
1615 </div>
1616 <hr>
1617 <div class="refsect2">
1618 <a name="g-stat"></a><h3>g_stat ()</h3>
1619 <pre class="programlisting"><span class="returnvalue">int</span>
1620 g_stat (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *filename</code></em>,
1621         <em class="parameter"><code><a class="link" href="glib-File-Utilities.html#GStatBuf" title="GStatBuf"><span class="type">GStatBuf</span></a> *buf</code></em>);</pre>
1622 <p>A wrapper for the POSIX <code class="function">stat()</code> function. The <code class="function">stat()</code> function
1623 returns information about a file. On Windows the <code class="function">stat()</code> function in
1624 the C library checks only the FAT-style READONLY attribute and does
1625 not look at the ACL at all. Thus on Windows the protection bits in
1626 the <em class="parameter"><code>st_mode</code></em>
1627  field are a fabrication of little use.</p>
1628 <p>On Windows the Microsoft C libraries have several variants of the
1629 stat struct and <code class="function">stat()</code> function with names like <code class="function">_stat()</code>, <code class="function">_stat32()</code>,
1630 <code class="function">_stat32i64()</code> and <code class="function">_stat64i32()</code>. The one used here is for 32-bit code
1631 the one with 32-bit size and time fields, specifically called <code class="function">_stat32()</code>.</p>
1632 <p>In Microsoft's compiler, by default struct stat means one with
1633 64-bit time fields while in MinGW struct stat is the legacy one
1634 with 32-bit fields. To hopefully clear up this messs, the gstdio.h
1635 header defines a type <a class="link" href="glib-File-Utilities.html#GStatBuf" title="GStatBuf"><span class="type">GStatBuf</span></a> which is the appropriate struct type
1636 depending on the platform and/or compiler being used. On POSIX it
1637 is just struct stat, but note that even on POSIX platforms, <code class="function">stat()</code>
1638 might be a macro.</p>
1639 <p>See your C library manual for more details about <code class="function">stat()</code>.</p>
1640 <div class="refsect3">
1641 <a name="g-stat.parameters"></a><h4>Parameters</h4>
1642 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1643 <colgroup>
1644 <col width="150px" class="parameters_name">
1645 <col class="parameters_description">
1646 <col width="200px" class="parameters_annotations">
1647 </colgroup>
1648 <tbody>
1649 <tr>
1650 <td class="parameter_name"><p>filename</p></td>
1651 <td class="parameter_description"><p> a pathname in the GLib file name encoding
1652 (UTF-8 on Windows). </p></td>
1653 <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename]</span></td>
1654 </tr>
1655 <tr>
1656 <td class="parameter_name"><p>buf</p></td>
1657 <td class="parameter_description"><p>a pointer to a stat struct, which will be filled with the file
1658 information</p></td>
1659 <td class="parameter_annotations"> </td>
1660 </tr>
1661 </tbody>
1662 </table></div>
1663 </div>
1664 <div class="refsect3">
1665 <a name="g-stat.returns"></a><h4>Returns</h4>
1666 <p> 0 if the information was successfully retrieved,
1667 -1 if an error occurred</p>
1668 </div>
1669 <p class="since">Since: <a class="link" href="api-index-2-6.html#api-index-2.6">2.6</a></p>
1670 </div>
1671 <hr>
1672 <div class="refsect2">
1673 <a name="g-lstat"></a><h3>g_lstat ()</h3>
1674 <pre class="programlisting"><span class="returnvalue">int</span>
1675 g_lstat (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *filename</code></em>,
1676          <em class="parameter"><code><a class="link" href="glib-File-Utilities.html#GStatBuf" title="GStatBuf"><span class="type">GStatBuf</span></a> *buf</code></em>);</pre>
1677 <p>A wrapper for the POSIX <code class="function">lstat()</code> function. The <code class="function">lstat()</code> function is
1678 like <code class="function">stat()</code> except that in the case of symbolic links, it returns
1679 information about the symbolic link itself and not the file that it
1680 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>
1681 is identical to <a class="link" href="glib-File-Utilities.html#g-stat" title="g_stat ()"><code class="function">g_stat()</code></a>.</p>
1682 <p>See your C library manual for more details about <code class="function">lstat()</code>.</p>
1683 <div class="refsect3">
1684 <a name="g-lstat.parameters"></a><h4>Parameters</h4>
1685 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1686 <colgroup>
1687 <col width="150px" class="parameters_name">
1688 <col class="parameters_description">
1689 <col width="200px" class="parameters_annotations">
1690 </colgroup>
1691 <tbody>
1692 <tr>
1693 <td class="parameter_name"><p>filename</p></td>
1694 <td class="parameter_description"><p> a pathname in the GLib file name encoding
1695 (UTF-8 on Windows). </p></td>
1696 <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename]</span></td>
1697 </tr>
1698 <tr>
1699 <td class="parameter_name"><p>buf</p></td>
1700 <td class="parameter_description"><p>a pointer to a stat struct, which will be filled with the file
1701 information</p></td>
1702 <td class="parameter_annotations"> </td>
1703 </tr>
1704 </tbody>
1705 </table></div>
1706 </div>
1707 <div class="refsect3">
1708 <a name="g-lstat.returns"></a><h4>Returns</h4>
1709 <p> 0 if the information was successfully retrieved,
1710 -1 if an error occurred</p>
1711 </div>
1712 <p class="since">Since: <a class="link" href="api-index-2-6.html#api-index-2.6">2.6</a></p>
1713 </div>
1714 <hr>
1715 <div class="refsect2">
1716 <a name="g-unlink"></a><h3>g_unlink ()</h3>
1717 <pre class="programlisting"><span class="returnvalue">int</span>
1718 g_unlink (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *filename</code></em>);</pre>
1719 <p>A wrapper for the POSIX <code class="function">unlink()</code> function. The <code class="function">unlink()</code> function 
1720 deletes a name from the filesystem. If this was the last link to the 
1721 file and no processes have it opened, the diskspace occupied by the
1722 file is freed.</p>
1723 <p>See your C library manual for more details about <code class="function">unlink()</code>. Note
1724 that on Windows, it is in general not possible to delete files that
1725 are open to some process, or mapped into memory.</p>
1726 <div class="refsect3">
1727 <a name="g-unlink.parameters"></a><h4>Parameters</h4>
1728 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1729 <colgroup>
1730 <col width="150px" class="parameters_name">
1731 <col class="parameters_description">
1732 <col width="200px" class="parameters_annotations">
1733 </colgroup>
1734 <tbody><tr>
1735 <td class="parameter_name"><p>filename</p></td>
1736 <td class="parameter_description"><p> a pathname in the GLib file name encoding
1737 (UTF-8 on Windows). </p></td>
1738 <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename]</span></td>
1739 </tr></tbody>
1740 </table></div>
1741 </div>
1742 <div class="refsect3">
1743 <a name="g-unlink.returns"></a><h4>Returns</h4>
1744 <p> 0 if the name was successfully deleted, -1 if an error
1745 occurred</p>
1746 </div>
1747 <p class="since">Since: <a class="link" href="api-index-2-6.html#api-index-2.6">2.6</a></p>
1748 </div>
1749 <hr>
1750 <div class="refsect2">
1751 <a name="g-remove"></a><h3>g_remove ()</h3>
1752 <pre class="programlisting"><span class="returnvalue">int</span>
1753 g_remove (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *filename</code></em>);</pre>
1754 <p>A wrapper for the POSIX <code class="function">remove()</code> function. The <code class="function">remove()</code> function
1755 deletes a name from the filesystem.</p>
1756 <p>See your C library manual for more details about how <code class="function">remove()</code> works
1757 on your system. On Unix, <code class="function">remove()</code> removes also directories, as it
1758 calls <code class="function">unlink()</code> for files and <code class="function">rmdir()</code> for directories. On Windows,
1759 although <code class="function">remove()</code> in the C library only works for files, this
1760 function tries first <code class="function">remove()</code> and then if that fails <code class="function">rmdir()</code>, and
1761 thus works for both files and directories. Note however, that on
1762 Windows, it is in general not possible to remove a file that is
1763 open to some process, or mapped into memory.</p>
1764 <p>If this function fails on Windows you can't infer too much from the
1765 errno value. <code class="function">rmdir()</code> is tried regardless of what caused <code class="function">remove()</code> to
1766 fail. Any errno value set by <code class="function">remove()</code> will be overwritten by that
1767 set by <code class="function">rmdir()</code>.</p>
1768 <div class="refsect3">
1769 <a name="g-remove.parameters"></a><h4>Parameters</h4>
1770 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1771 <colgroup>
1772 <col width="150px" class="parameters_name">
1773 <col class="parameters_description">
1774 <col width="200px" class="parameters_annotations">
1775 </colgroup>
1776 <tbody><tr>
1777 <td class="parameter_name"><p>filename</p></td>
1778 <td class="parameter_description"><p> a pathname in the GLib file name encoding
1779 (UTF-8 on Windows). </p></td>
1780 <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename]</span></td>
1781 </tr></tbody>
1782 </table></div>
1783 </div>
1784 <div class="refsect3">
1785 <a name="g-remove.returns"></a><h4>Returns</h4>
1786 <p> 0 if the file was successfully removed, -1 if an error
1787 occurred</p>
1788 </div>
1789 <p class="since">Since: <a class="link" href="api-index-2-6.html#api-index-2.6">2.6</a></p>
1790 </div>
1791 <hr>
1792 <div class="refsect2">
1793 <a name="g-rmdir"></a><h3>g_rmdir ()</h3>
1794 <pre class="programlisting"><span class="returnvalue">int</span>
1795 g_rmdir (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *filename</code></em>);</pre>
1796 <p>A wrapper for the POSIX <code class="function">rmdir()</code> function. The <code class="function">rmdir()</code> function
1797 deletes a directory from the filesystem.</p>
1798 <p>See your C library manual for more details about how <code class="function">rmdir()</code> works
1799 on your system.</p>
1800 <div class="refsect3">
1801 <a name="g-rmdir.parameters"></a><h4>Parameters</h4>
1802 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1803 <colgroup>
1804 <col width="150px" class="parameters_name">
1805 <col class="parameters_description">
1806 <col width="200px" class="parameters_annotations">
1807 </colgroup>
1808 <tbody><tr>
1809 <td class="parameter_name"><p>filename</p></td>
1810 <td class="parameter_description"><p> a pathname in the GLib file name encoding
1811 (UTF-8 on Windows). </p></td>
1812 <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename]</span></td>
1813 </tr></tbody>
1814 </table></div>
1815 </div>
1816 <div class="refsect3">
1817 <a name="g-rmdir.returns"></a><h4>Returns</h4>
1818 <p> 0 if the directory was successfully removed, -1 if an error
1819 occurred</p>
1820 </div>
1821 <p class="since">Since: <a class="link" href="api-index-2-6.html#api-index-2.6">2.6</a></p>
1822 </div>
1823 <hr>
1824 <div class="refsect2">
1825 <a name="g-fopen"></a><h3>g_fopen ()</h3>
1826 <pre class="programlisting"><span class="returnvalue">FILE</span> *
1827 g_fopen (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *filename</code></em>,
1828          <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *mode</code></em>);</pre>
1829 <p>A wrapper for the stdio <code class="function">fopen()</code> function. The <code class="function">fopen()</code> function
1830 opens a file and associates a new stream with it.</p>
1831 <p>Because file descriptors are specific to the C library on Windows,
1832 and a file descriptor is part of the FILE struct, the FILE* returned
1833 by this function makes sense only to functions in the same C library.
1834 Thus if the GLib-using code uses a different C library than GLib does,
1835 the FILE* returned by this function cannot be passed to C library
1836 functions like <code class="function">fprintf()</code> or <code class="function">fread()</code>.</p>
1837 <p>See your C library manual for more details about <code class="function">fopen()</code>.</p>
1838 <div class="refsect3">
1839 <a name="g-fopen.parameters"></a><h4>Parameters</h4>
1840 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1841 <colgroup>
1842 <col width="150px" class="parameters_name">
1843 <col class="parameters_description">
1844 <col width="200px" class="parameters_annotations">
1845 </colgroup>
1846 <tbody>
1847 <tr>
1848 <td class="parameter_name"><p>filename</p></td>
1849 <td class="parameter_description"><p> a pathname in the GLib file name encoding
1850 (UTF-8 on Windows). </p></td>
1851 <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename]</span></td>
1852 </tr>
1853 <tr>
1854 <td class="parameter_name"><p>mode</p></td>
1855 <td class="parameter_description"><p>a string describing the mode in which the file should be opened</p></td>
1856 <td class="parameter_annotations"> </td>
1857 </tr>
1858 </tbody>
1859 </table></div>
1860 </div>
1861 <div class="refsect3">
1862 <a name="g-fopen.returns"></a><h4>Returns</h4>
1863 <p> A FILE* if the file was successfully opened, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if
1864 an error occurred</p>
1865 </div>
1866 <p class="since">Since: <a class="link" href="api-index-2-6.html#api-index-2.6">2.6</a></p>
1867 </div>
1868 <hr>
1869 <div class="refsect2">
1870 <a name="g-freopen"></a><h3>g_freopen ()</h3>
1871 <pre class="programlisting"><span class="returnvalue">FILE</span> *
1872 g_freopen (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *filename</code></em>,
1873            <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *mode</code></em>,
1874            <em class="parameter"><code><span class="type">FILE</span> *stream</code></em>);</pre>
1875 <p>A wrapper for the POSIX <code class="function">freopen()</code> function. The <code class="function">freopen()</code> function
1876 opens a file and associates it with an existing stream.</p>
1877 <p>See your C library manual for more details about <code class="function">freopen()</code>.</p>
1878 <div class="refsect3">
1879 <a name="g-freopen.parameters"></a><h4>Parameters</h4>
1880 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1881 <colgroup>
1882 <col width="150px" class="parameters_name">
1883 <col class="parameters_description">
1884 <col width="200px" class="parameters_annotations">
1885 </colgroup>
1886 <tbody>
1887 <tr>
1888 <td class="parameter_name"><p>filename</p></td>
1889 <td class="parameter_description"><p> a pathname in the GLib file name encoding
1890 (UTF-8 on Windows). </p></td>
1891 <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename]</span></td>
1892 </tr>
1893 <tr>
1894 <td class="parameter_name"><p>mode</p></td>
1895 <td class="parameter_description"><p>a string describing the mode in which the file should be  opened</p></td>
1896 <td class="parameter_annotations"> </td>
1897 </tr>
1898 <tr>
1899 <td class="parameter_name"><p>stream</p></td>
1900 <td class="parameter_description"><p> 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>. </p></td>
1901 <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
1902 </tr>
1903 </tbody>
1904 </table></div>
1905 </div>
1906 <div class="refsect3">
1907 <a name="g-freopen.returns"></a><h4>Returns</h4>
1908 <p> A FILE* if the file was successfully opened, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if
1909 an error occurred.</p>
1910 </div>
1911 <p class="since">Since: <a class="link" href="api-index-2-6.html#api-index-2.6">2.6</a></p>
1912 </div>
1913 <hr>
1914 <div class="refsect2">
1915 <a name="g-chmod"></a><h3>g_chmod ()</h3>
1916 <pre class="programlisting"><span class="returnvalue">int</span>
1917 g_chmod (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *filename</code></em>,
1918          <em class="parameter"><code><span class="type">int</span> mode</code></em>);</pre>
1919 <p>A wrapper for the POSIX <code class="function">chmod()</code> function. The <code class="function">chmod()</code> function is
1920 used to set the permissions of a file system object.</p>
1921 <p>On Windows the file protection mechanism is not at all POSIX-like,
1922 and the underlying <code class="function">chmod()</code> function in the C library just sets or
1923 clears the FAT-style READONLY attribute. It does not touch any
1924 ACL. Software that needs to manage file permissions on Windows
1925 exactly should use the Win32 API.</p>
1926 <p>See your C library manual for more details about <code class="function">chmod()</code>.</p>
1927 <div class="refsect3">
1928 <a name="g-chmod.parameters"></a><h4>Parameters</h4>
1929 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1930 <colgroup>
1931 <col width="150px" class="parameters_name">
1932 <col class="parameters_description">
1933 <col width="200px" class="parameters_annotations">
1934 </colgroup>
1935 <tbody>
1936 <tr>
1937 <td class="parameter_name"><p>filename</p></td>
1938 <td class="parameter_description"><p> a pathname in the GLib file name encoding
1939 (UTF-8 on Windows). </p></td>
1940 <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename]</span></td>
1941 </tr>
1942 <tr>
1943 <td class="parameter_name"><p>mode</p></td>
1944 <td class="parameter_description"><p>as in <code class="function">chmod()</code></p></td>
1945 <td class="parameter_annotations"> </td>
1946 </tr>
1947 </tbody>
1948 </table></div>
1949 </div>
1950 <div class="refsect3">
1951 <a name="g-chmod.returns"></a><h4>Returns</h4>
1952 <p> 0 if the operation succeeded, -1 on error</p>
1953 </div>
1954 <p class="since">Since: <a class="link" href="api-index-2-8.html#api-index-2.8">2.8</a></p>
1955 </div>
1956 <hr>
1957 <div class="refsect2">
1958 <a name="g-access"></a><h3>g_access ()</h3>
1959 <pre class="programlisting"><span class="returnvalue">int</span>
1960 g_access (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *filename</code></em>,
1961           <em class="parameter"><code><span class="type">int</span> mode</code></em>);</pre>
1962 <p>A wrapper for the POSIX <code class="function">access()</code> function. This function is used to
1963 test a pathname for one or several of read, write or execute
1964 permissions, or just existence.</p>
1965 <p>On Windows, the file protection mechanism is not at all POSIX-like,
1966 and the underlying function in the C library only checks the
1967 FAT-style READONLY attribute, and does not look at the ACL of a
1968 file at all. This function is this in practise almost useless on
1969 Windows. Software that needs to handle file permissions on Windows
1970 more exactly should use the Win32 API.</p>
1971 <p>See your C library manual for more details about <code class="function">access()</code>.</p>
1972 <div class="refsect3">
1973 <a name="g-access.parameters"></a><h4>Parameters</h4>
1974 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1975 <colgroup>
1976 <col width="150px" class="parameters_name">
1977 <col class="parameters_description">
1978 <col width="200px" class="parameters_annotations">
1979 </colgroup>
1980 <tbody>
1981 <tr>
1982 <td class="parameter_name"><p>filename</p></td>
1983 <td class="parameter_description"><p> a pathname in the GLib file name encoding
1984 (UTF-8 on Windows). </p></td>
1985 <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename]</span></td>
1986 </tr>
1987 <tr>
1988 <td class="parameter_name"><p>mode</p></td>
1989 <td class="parameter_description"><p>as in <code class="function">access()</code></p></td>
1990 <td class="parameter_annotations"> </td>
1991 </tr>
1992 </tbody>
1993 </table></div>
1994 </div>
1995 <div class="refsect3">
1996 <a name="g-access.returns"></a><h4>Returns</h4>
1997 <p> zero if the pathname refers to an existing file system
1998 object that has all the tested permissions, or -1 otherwise
1999 or on error.</p>
2000 </div>
2001 <p class="since">Since: <a class="link" href="api-index-2-8.html#api-index-2.8">2.8</a></p>
2002 </div>
2003 <hr>
2004 <div class="refsect2">
2005 <a name="g-creat"></a><h3>g_creat ()</h3>
2006 <pre class="programlisting"><span class="returnvalue">int</span>
2007 g_creat (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *filename</code></em>,
2008          <em class="parameter"><code><span class="type">int</span> mode</code></em>);</pre>
2009 <p>A wrapper for the POSIX <code class="function">creat()</code> function. The <code class="function">creat()</code> function is
2010 used to convert a pathname into a file descriptor, creating a file
2011 if necessary.</p>
2012 <p>On POSIX systems file descriptors are implemented by the operating
2013 system. On Windows, it's the C library that implements <code class="function">creat()</code> and
2014 file descriptors. The actual Windows API for opening files is
2015 different, see MSDN documentation for <code class="function">CreateFile()</code>. The Win32 API
2016 uses file handles, which are more randomish integers, not small
2017 integers like file descriptors.</p>
2018 <p>Because file descriptors are specific to the C library on Windows,
2019 the file descriptor returned by this function makes sense only to
2020 functions in the same C library. Thus if the GLib-using code uses a
2021 different C library than GLib does, the file descriptor returned by
2022 this function cannot be passed to C library functions like <code class="function">write()</code>
2023 or <code class="function">read()</code>.</p>
2024 <p>See your C library manual for more details about <code class="function">creat()</code>.</p>
2025 <div class="refsect3">
2026 <a name="g-creat.parameters"></a><h4>Parameters</h4>
2027 <div class="informaltable"><table class="informaltable" width="100%" border="0">
2028 <colgroup>
2029 <col width="150px" class="parameters_name">
2030 <col class="parameters_description">
2031 <col width="200px" class="parameters_annotations">
2032 </colgroup>
2033 <tbody>
2034 <tr>
2035 <td class="parameter_name"><p>filename</p></td>
2036 <td class="parameter_description"><p> a pathname in the GLib file name encoding
2037 (UTF-8 on Windows). </p></td>
2038 <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename]</span></td>
2039 </tr>
2040 <tr>
2041 <td class="parameter_name"><p>mode</p></td>
2042 <td class="parameter_description"><p>as in <code class="function">creat()</code></p></td>
2043 <td class="parameter_annotations"> </td>
2044 </tr>
2045 </tbody>
2046 </table></div>
2047 </div>
2048 <div class="refsect3">
2049 <a name="g-creat.returns"></a><h4>Returns</h4>
2050 <p> a new file descriptor, or -1 if an error occurred.
2051 The return value can be used exactly like the return value
2052 from <code class="function">creat()</code>.</p>
2053 </div>
2054 <p class="since">Since: <a class="link" href="api-index-2-8.html#api-index-2.8">2.8</a></p>
2055 </div>
2056 <hr>
2057 <div class="refsect2">
2058 <a name="g-chdir"></a><h3>g_chdir ()</h3>
2059 <pre class="programlisting"><span class="returnvalue">int</span>
2060 g_chdir (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *path</code></em>);</pre>
2061 <p>A wrapper for the POSIX <code class="function">chdir()</code> function. The function changes the
2062 current directory of the process to <em class="parameter"><code>path</code></em>
2063 .</p>
2064 <p>See your C library manual for more details about <code class="function">chdir()</code>.</p>
2065 <div class="refsect3">
2066 <a name="g-chdir.parameters"></a><h4>Parameters</h4>
2067 <div class="informaltable"><table class="informaltable" width="100%" border="0">
2068 <colgroup>
2069 <col width="150px" class="parameters_name">
2070 <col class="parameters_description">
2071 <col width="200px" class="parameters_annotations">
2072 </colgroup>
2073 <tbody><tr>
2074 <td class="parameter_name"><p>path</p></td>
2075 <td class="parameter_description"><p> a pathname in the GLib file name encoding
2076 (UTF-8 on Windows). </p></td>
2077 <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename]</span></td>
2078 </tr></tbody>
2079 </table></div>
2080 </div>
2081 <div class="refsect3">
2082 <a name="g-chdir.returns"></a><h4>Returns</h4>
2083 <p> 0 on success, -1 if an error occurred.</p>
2084 </div>
2085 <p class="since">Since: <a class="link" href="api-index-2-8.html#api-index-2.8">2.8</a></p>
2086 </div>
2087 <hr>
2088 <div class="refsect2">
2089 <a name="g-utime"></a><h3>g_utime ()</h3>
2090 <pre class="programlisting"><span class="returnvalue">int</span>
2091 g_utime (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *filename</code></em>,
2092          <em class="parameter"><code><span class="type">struct utimbuf</span> *utb</code></em>);</pre>
2093 <p>A wrapper for the POSIX <code class="function">utime()</code> function. The <code class="function">utime()</code> function
2094 sets the access and modification timestamps of a file.</p>
2095 <p>See your C library manual for more details about how <code class="function">utime()</code> works
2096 on your system.</p>
2097 <div class="refsect3">
2098 <a name="g-utime.parameters"></a><h4>Parameters</h4>
2099 <div class="informaltable"><table class="informaltable" width="100%" border="0">
2100 <colgroup>
2101 <col width="150px" class="parameters_name">
2102 <col class="parameters_description">
2103 <col width="200px" class="parameters_annotations">
2104 </colgroup>
2105 <tbody>
2106 <tr>
2107 <td class="parameter_name"><p>filename</p></td>
2108 <td class="parameter_description"><p> a pathname in the GLib file name encoding
2109 (UTF-8 on Windows). </p></td>
2110 <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename]</span></td>
2111 </tr>
2112 <tr>
2113 <td class="parameter_name"><p>utb</p></td>
2114 <td class="parameter_description"><p>a pointer to a struct utimbuf.</p></td>
2115 <td class="parameter_annotations"> </td>
2116 </tr>
2117 </tbody>
2118 </table></div>
2119 </div>
2120 <div class="refsect3">
2121 <a name="g-utime.returns"></a><h4>Returns</h4>
2122 <p> 0 if the operation was successful, -1 if an error occurred</p>
2123 </div>
2124 <p class="since">Since: <a class="link" href="api-index-2-18.html#api-index-2.18">2.18</a></p>
2125 </div>
2126 <hr>
2127 <div class="refsect2">
2128 <a name="g-close"></a><h3>g_close ()</h3>
2129 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
2130 g_close (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="type">gint</span></a> fd</code></em>,
2131          <em class="parameter"><code><a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> **error</code></em>);</pre>
2132 <p>This wraps the <code class="function">close()</code> call; in case of error, <code class="literal">errno</code> will be
2133 preserved, but the error will also be stored as a <a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> in <em class="parameter"><code>error</code></em>
2134 .</p>
2135 <p>Besides using <a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a>, there is another major reason to prefer this
2136 function over the call provided by the system; on Unix, it will
2137 attempt to correctly handle <code class="literal">EINTR</code>, which has platform-specific
2138 semantics.</p>
2139 <div class="refsect3">
2140 <a name="g-close.parameters"></a><h4>Parameters</h4>
2141 <div class="informaltable"><table class="informaltable" width="100%" border="0">
2142 <colgroup>
2143 <col width="150px" class="parameters_name">
2144 <col class="parameters_description">
2145 <col width="200px" class="parameters_annotations">
2146 </colgroup>
2147 <tbody>
2148 <tr>
2149 <td class="parameter_name"><p>fd</p></td>
2150 <td class="parameter_description"><p>A file descriptor</p></td>
2151 <td class="parameter_annotations"> </td>
2152 </tr>
2153 <tr>
2154 <td class="parameter_name"><p>error</p></td>
2155 <td class="parameter_description"><p>a <a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a></p></td>
2156 <td class="parameter_annotations"> </td>
2157 </tr>
2158 </tbody>
2159 </table></div>
2160 </div>
2161 <div class="refsect3">
2162 <a name="g-close.returns"></a><h4>Returns</h4>
2163 <p> <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 there was an error.</p>
2164 </div>
2165 <p class="since">Since: <a class="link" href="api-index-2-36.html#api-index-2.36">2.36</a></p>
2166 </div>
2167 </div>
2168 <div class="refsect1">
2169 <a name="glib-File-Utilities.other_details"></a><h2>Types and Values</h2>
2170 <div class="refsect2">
2171 <a name="GFileError"></a><h3>enum GFileError</h3>
2172 <p>Values corresponding to <em class="parameter"><code>errno</code></em>
2173  codes returned from file operations
2174 on UNIX. Unlike <em class="parameter"><code>errno</code></em>
2175  codes, GFileError values are available on
2176 all systems, even Windows. The exact meaning of each code depends
2177 on what sort of file operation you were performing; the UNIX
2178 documentation gives more details. The following error code descriptions
2179 come from the GNU C Library manual, and are under the copyright
2180 of that manual.</p>
2181 <p>It's not very portable to make detailed assumptions about exactly
2182 which errors will be returned from a given operation. Some errors
2183 don't occur on some systems, etc., sometimes there are subtle
2184 differences in when a system will report a given error, etc.</p>
2185 <div class="refsect3">
2186 <a name="GFileError.members"></a><h4>Members</h4>
2187 <div class="informaltable"><table class="informaltable" width="100%" border="0">
2188 <colgroup>
2189 <col width="300px" class="enum_members_name">
2190 <col class="enum_members_description">
2191 <col width="200px" class="enum_members_annotations">
2192 </colgroup>
2193 <tbody>
2194 <tr>
2195 <td class="enum_member_name"><p><a name="G-FILE-ERROR-EXIST:CAPS"></a>G_FILE_ERROR_EXIST</p></td>
2196 <td class="enum_member_description">
2197 <p>Operation not permitted; only the owner of
2198     the file (or other resource) or processes with special privileges
2199     can perform the operation.</p>
2200 </td>
2201 <td class="enum_member_annotations"> </td>
2202 </tr>
2203 <tr>
2204 <td class="enum_member_name"><p><a name="G-FILE-ERROR-ISDIR:CAPS"></a>G_FILE_ERROR_ISDIR</p></td>
2205 <td class="enum_member_description">
2206 <p>File is a directory; you cannot open a directory
2207     for writing, or create or remove hard links to it.</p>
2208 </td>
2209 <td class="enum_member_annotations"> </td>
2210 </tr>
2211 <tr>
2212 <td class="enum_member_name"><p><a name="G-FILE-ERROR-ACCES:CAPS"></a>G_FILE_ERROR_ACCES</p></td>
2213 <td class="enum_member_description">
2214 <p>Permission denied; the file permissions do not
2215     allow the attempted operation.</p>
2216 </td>
2217 <td class="enum_member_annotations"> </td>
2218 </tr>
2219 <tr>
2220 <td class="enum_member_name"><p><a name="G-FILE-ERROR-NAMETOOLONG:CAPS"></a>G_FILE_ERROR_NAMETOOLONG</p></td>
2221 <td class="enum_member_description">
2222 <p>Filename too long.</p>
2223 </td>
2224 <td class="enum_member_annotations"> </td>
2225 </tr>
2226 <tr>
2227 <td class="enum_member_name"><p><a name="G-FILE-ERROR-NOENT:CAPS"></a>G_FILE_ERROR_NOENT</p></td>
2228 <td class="enum_member_description">
2229 <p>No such file or directory. This is a "file
2230     doesn't exist" error for ordinary files that are referenced in
2231     contexts where they are expected to already exist.</p>
2232 </td>
2233 <td class="enum_member_annotations"> </td>
2234 </tr>
2235 <tr>
2236 <td class="enum_member_name"><p><a name="G-FILE-ERROR-NOTDIR:CAPS"></a>G_FILE_ERROR_NOTDIR</p></td>
2237 <td class="enum_member_description">
2238 <p>A file that isn't a directory was specified when
2239     a directory is required.</p>
2240 </td>
2241 <td class="enum_member_annotations"> </td>
2242 </tr>
2243 <tr>
2244 <td class="enum_member_name"><p><a name="G-FILE-ERROR-NXIO:CAPS"></a>G_FILE_ERROR_NXIO</p></td>
2245 <td class="enum_member_description">
2246 <p>No such device or address. The system tried to
2247     use the device represented by a file you specified, and it
2248     couldn't find the device. This can mean that the device file was
2249     installed incorrectly, or that the physical device is missing or
2250     not correctly attached to the computer.</p>
2251 </td>
2252 <td class="enum_member_annotations"> </td>
2253 </tr>
2254 <tr>
2255 <td class="enum_member_name"><p><a name="G-FILE-ERROR-NODEV:CAPS"></a>G_FILE_ERROR_NODEV</p></td>
2256 <td class="enum_member_description">
2257 <p>The underlying file system of the specified file
2258     does not support memory mapping.</p>
2259 </td>
2260 <td class="enum_member_annotations"> </td>
2261 </tr>
2262 <tr>
2263 <td class="enum_member_name"><p><a name="G-FILE-ERROR-ROFS:CAPS"></a>G_FILE_ERROR_ROFS</p></td>
2264 <td class="enum_member_description">
2265 <p>The directory containing the new link can't be
2266     modified because it's on a read-only file system.</p>
2267 </td>
2268 <td class="enum_member_annotations"> </td>
2269 </tr>
2270 <tr>
2271 <td class="enum_member_name"><p><a name="G-FILE-ERROR-TXTBSY:CAPS"></a>G_FILE_ERROR_TXTBSY</p></td>
2272 <td class="enum_member_description">
2273 <p>Text file busy.</p>
2274 </td>
2275 <td class="enum_member_annotations"> </td>
2276 </tr>
2277 <tr>
2278 <td class="enum_member_name"><p><a name="G-FILE-ERROR-FAULT:CAPS"></a>G_FILE_ERROR_FAULT</p></td>
2279 <td class="enum_member_description">
2280 <p>You passed in a pointer to bad memory.
2281     (GLib won't reliably return this, don't pass in pointers to bad
2282     memory.)</p>
2283 </td>
2284 <td class="enum_member_annotations"> </td>
2285 </tr>
2286 <tr>
2287 <td class="enum_member_name"><p><a name="G-FILE-ERROR-LOOP:CAPS"></a>G_FILE_ERROR_LOOP</p></td>
2288 <td class="enum_member_description">
2289 <p>Too many levels of symbolic links were encountered
2290     in looking up a file name. This often indicates a cycle of symbolic
2291     links.</p>
2292 </td>
2293 <td class="enum_member_annotations"> </td>
2294 </tr>
2295 <tr>
2296 <td class="enum_member_name"><p><a name="G-FILE-ERROR-NOSPC:CAPS"></a>G_FILE_ERROR_NOSPC</p></td>
2297 <td class="enum_member_description">
2298 <p>No space left on device; write operation on a
2299     file failed because the disk is full.</p>
2300 </td>
2301 <td class="enum_member_annotations"> </td>
2302 </tr>
2303 <tr>
2304 <td class="enum_member_name"><p><a name="G-FILE-ERROR-NOMEM:CAPS"></a>G_FILE_ERROR_NOMEM</p></td>
2305 <td class="enum_member_description">
2306 <p>No memory available. The system cannot allocate
2307     more virtual memory because its capacity is full.</p>
2308 </td>
2309 <td class="enum_member_annotations"> </td>
2310 </tr>
2311 <tr>
2312 <td class="enum_member_name"><p><a name="G-FILE-ERROR-MFILE:CAPS"></a>G_FILE_ERROR_MFILE</p></td>
2313 <td class="enum_member_description">
2314 <p>The current process has too many files open and
2315     can't open any more. Duplicate descriptors do count toward this
2316     limit.</p>
2317 </td>
2318 <td class="enum_member_annotations"> </td>
2319 </tr>
2320 <tr>
2321 <td class="enum_member_name"><p><a name="G-FILE-ERROR-NFILE:CAPS"></a>G_FILE_ERROR_NFILE</p></td>
2322 <td class="enum_member_description">
2323 <p>There are too many distinct file openings in the
2324     entire system.</p>
2325 </td>
2326 <td class="enum_member_annotations"> </td>
2327 </tr>
2328 <tr>
2329 <td class="enum_member_name"><p><a name="G-FILE-ERROR-BADF:CAPS"></a>G_FILE_ERROR_BADF</p></td>
2330 <td class="enum_member_description">
2331 <p>Bad file descriptor; for example, I/O on a
2332     descriptor that has been closed or reading from a descriptor open
2333     only for writing (or vice versa).</p>
2334 </td>
2335 <td class="enum_member_annotations"> </td>
2336 </tr>
2337 <tr>
2338 <td class="enum_member_name"><p><a name="G-FILE-ERROR-INVAL:CAPS"></a>G_FILE_ERROR_INVAL</p></td>
2339 <td class="enum_member_description">
2340 <p>Invalid argument. This is used to indicate
2341     various kinds of problems with passing the wrong argument to a
2342     library function.</p>
2343 </td>
2344 <td class="enum_member_annotations"> </td>
2345 </tr>
2346 <tr>
2347 <td class="enum_member_name"><p><a name="G-FILE-ERROR-PIPE:CAPS"></a>G_FILE_ERROR_PIPE</p></td>
2348 <td class="enum_member_description">
2349 <p>Broken pipe; there is no process reading from the
2350     other end of a pipe. Every library function that returns this
2351     error code also generates a 'SIGPIPE' signal; this signal
2352     terminates the program if not handled or blocked. Thus, your
2353     program will never actually see this code unless it has handled
2354     or blocked 'SIGPIPE'.</p>
2355 </td>
2356 <td class="enum_member_annotations"> </td>
2357 </tr>
2358 <tr>
2359 <td class="enum_member_name"><p><a name="G-FILE-ERROR-AGAIN:CAPS"></a>G_FILE_ERROR_AGAIN</p></td>
2360 <td class="enum_member_description">
2361 <p>Resource temporarily unavailable; the call might
2362     work if you try again later.</p>
2363 </td>
2364 <td class="enum_member_annotations"> </td>
2365 </tr>
2366 <tr>
2367 <td class="enum_member_name"><p><a name="G-FILE-ERROR-INTR:CAPS"></a>G_FILE_ERROR_INTR</p></td>
2368 <td class="enum_member_description">
2369 <p>Interrupted function call; an asynchronous signal
2370     occurred and prevented completion of the call. When this
2371     happens, you should try the call again.</p>
2372 </td>
2373 <td class="enum_member_annotations"> </td>
2374 </tr>
2375 <tr>
2376 <td class="enum_member_name"><p><a name="G-FILE-ERROR-IO:CAPS"></a>G_FILE_ERROR_IO</p></td>
2377 <td class="enum_member_description">
2378 <p>Input/output error; usually used for physical read
2379    or write errors. i.e. the disk or other physical device hardware
2380    is returning errors.</p>
2381 </td>
2382 <td class="enum_member_annotations"> </td>
2383 </tr>
2384 <tr>
2385 <td class="enum_member_name"><p><a name="G-FILE-ERROR-PERM:CAPS"></a>G_FILE_ERROR_PERM</p></td>
2386 <td class="enum_member_description">
2387 <p>Operation not permitted; only the owner of the
2388    file (or other resource) or processes with special privileges can
2389    perform the operation.</p>
2390 </td>
2391 <td class="enum_member_annotations"> </td>
2392 </tr>
2393 <tr>
2394 <td class="enum_member_name"><p><a name="G-FILE-ERROR-NOSYS:CAPS"></a>G_FILE_ERROR_NOSYS</p></td>
2395 <td class="enum_member_description">
2396 <p>Function not implemented; this indicates that
2397    the system is missing some functionality.</p>
2398 </td>
2399 <td class="enum_member_annotations"> </td>
2400 </tr>
2401 <tr>
2402 <td class="enum_member_name"><p><a name="G-FILE-ERROR-FAILED:CAPS"></a>G_FILE_ERROR_FAILED</p></td>
2403 <td class="enum_member_description">
2404 <p>Does not correspond to a UNIX error code; this
2405    is the standard "failed for unspecified reason" error code present
2406    in all <a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> error code enumerations. Returned if no specific
2407    code applies.</p>
2408 </td>
2409 <td class="enum_member_annotations"> </td>
2410 </tr>
2411 </tbody>
2412 </table></div>
2413 </div>
2414 </div>
2415 <hr>
2416 <div class="refsect2">
2417 <a name="G-FILE-ERROR:CAPS"></a><h3>G_FILE_ERROR</h3>
2418 <pre class="programlisting">#define G_FILE_ERROR g_file_error_quark ()
2419 </pre>
2420 <p>Error domain for file operations. Errors in this domain will
2421 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="struct GError"><span class="type">GError</span></a> for information
2422 on error domains.</p>
2423 </div>
2424 <hr>
2425 <div class="refsect2">
2426 <a name="GFileTest"></a><h3>enum GFileTest</h3>
2427 <p>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>.</p>
2428 <div class="refsect3">
2429 <a name="GFileTest.members"></a><h4>Members</h4>
2430 <div class="informaltable"><table class="informaltable" width="100%" border="0">
2431 <colgroup>
2432 <col width="300px" class="enum_members_name">
2433 <col class="enum_members_description">
2434 <col width="200px" class="enum_members_annotations">
2435 </colgroup>
2436 <tbody>
2437 <tr>
2438 <td class="enum_member_name"><p><a name="G-FILE-TEST-IS-REGULAR:CAPS"></a>G_FILE_TEST_IS_REGULAR</p></td>
2439 <td class="enum_member_description">
2440 <p><a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the file is a regular file
2441     (not a directory). 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>
2442     if the tested file is a symlink to a regular file.</p>
2443 </td>
2444 <td class="enum_member_annotations"> </td>
2445 </tr>
2446 <tr>
2447 <td class="enum_member_name"><p><a name="G-FILE-TEST-IS-SYMLINK:CAPS"></a>G_FILE_TEST_IS_SYMLINK</p></td>
2448 <td class="enum_member_description">
2449 <p><a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the file is a symlink.</p>
2450 </td>
2451 <td class="enum_member_annotations"> </td>
2452 </tr>
2453 <tr>
2454 <td class="enum_member_name"><p><a name="G-FILE-TEST-IS-DIR:CAPS"></a>G_FILE_TEST_IS_DIR</p></td>
2455 <td class="enum_member_description">
2456 <p><a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the file is a directory.</p>
2457 </td>
2458 <td class="enum_member_annotations"> </td>
2459 </tr>
2460 <tr>
2461 <td class="enum_member_name"><p><a name="G-FILE-TEST-IS-EXECUTABLE:CAPS"></a>G_FILE_TEST_IS_EXECUTABLE</p></td>
2462 <td class="enum_member_description">
2463 <p><a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the file is executable.</p>
2464 </td>
2465 <td class="enum_member_annotations"> </td>
2466 </tr>
2467 <tr>
2468 <td class="enum_member_name"><p><a name="G-FILE-TEST-EXISTS:CAPS"></a>G_FILE_TEST_EXISTS</p></td>
2469 <td class="enum_member_description">
2470 <p><a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the file exists. It may or may not
2471     be a regular file.</p>
2472 </td>
2473 <td class="enum_member_annotations"> </td>
2474 </tr>
2475 </tbody>
2476 </table></div>
2477 </div>
2478 </div>
2479 <hr>
2480 <div class="refsect2">
2481 <a name="GDir"></a><h3>GDir</h3>
2482 <pre class="programlisting">typedef struct _GDir GDir;</pre>
2483 <p>An opaque structure representing an opened directory.</p>
2484 </div>
2485 <hr>
2486 <div class="refsect2">
2487 <a name="GMappedFile"></a><h3>GMappedFile</h3>
2488 <pre class="programlisting">typedef struct _GMappedFile GMappedFile;</pre>
2489 <p>The <a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="type">GMappedFile</span></a> represents a file mapping created with
2490 <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
2491 not be accessed directly.</p>
2492 </div>
2493 <hr>
2494 <div class="refsect2">
2495 <a name="GStatBuf"></a><h3>GStatBuf</h3>
2496 <pre class="programlisting">typedef struct _stat32 GStatBuf;
2497 </pre>
2498 <p>A type corresponding to the appropriate struct type for the <code class="function">stat()</code>
2499 system call, depending on the platform and/or compiler being used.</p>
2500 <p>See <a class="link" href="glib-File-Utilities.html#g-stat" title="g_stat ()"><code class="function">g_stat()</code></a> for more information.</p>
2501 </div>
2502 </div>
2503 </div>
2504 <div class="footer">
2505 <hr>Generated by GTK-Doc V1.25.1</div>
2506 </body>
2507 </html>