58
58
<div class="refsynopsisdiv" title="Synopsis">
59
59
<a name="glib-File-Utilities.synopsis"></a><h2>Synopsis</h2>
60
60
<pre class="synopsis">
61
62
#include <glib.h>
62
63
#include <glib/gstdio.h>
64
65
enum <a class="link" href="glib-File-Utilities.html#GFileError" title="enum GFileError">GFileError</a>;
65
#define <a class="link" href="glib-File-Utilities.html#G-FILE-ERROR:CAPS" title="G_FILE_ERROR">G_FILE_ERROR</a>
66
#define <a class="link" href="glib-File-Utilities.html#G-FILE-ERROR--CAPS" title="G_FILE_ERROR">G_FILE_ERROR</a>
66
67
enum <a class="link" href="glib-File-Utilities.html#GFileTest" title="enum GFileTest">GFileTest</a>;
67
<a class="link" href="glib-File-Utilities.html#GFileError" title="enum GFileError"><span class="returnvalue">GFileError</span></a> <a class="link" href="glib-File-Utilities.html#g-file-error-from-errno" title="g_file_error_from_errno ()">g_file_error_from_errno</a> (<a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> err_no);
68
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="glib-File-Utilities.html#g-file-get-contents" title="g_file_get_contents ()">g_file_get_contents</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *filename,
69
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> **contents,
70
<a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a> *length,
71
<a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="returnvalue">GError</span></a> **error);
72
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="glib-File-Utilities.html#g-file-set-contents" title="g_file_set_contents ()">g_file_set_contents</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *filename,
73
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *contents,
74
<a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="returnvalue">gssize</span></a> length,
75
<a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="returnvalue">GError</span></a> **error);
76
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="glib-File-Utilities.html#g-file-test" title="g_file_test ()">g_file_test</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *filename,
77
<a class="link" href="glib-File-Utilities.html#GFileTest" title="enum GFileTest"><span class="returnvalue">GFileTest</span></a> test);
78
<a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> <a class="link" href="glib-File-Utilities.html#g-mkstemp" title="g_mkstemp ()">g_mkstemp</a> (<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *tmpl);
79
<a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> <a class="link" href="glib-File-Utilities.html#g-mkstemp-full" title="g_mkstemp_full ()">g_mkstemp_full</a> (<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *tmpl,
80
<span class="returnvalue">int</span> flags,
81
<span class="returnvalue">int</span> mode);
82
<a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> <a class="link" href="glib-File-Utilities.html#g-file-open-tmp" title="g_file_open_tmp ()">g_file_open_tmp</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *tmpl,
83
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> **name_used,
84
<a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="returnvalue">GError</span></a> **error);
85
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * <a class="link" href="glib-File-Utilities.html#g-file-read-link" title="g_file_read_link ()">g_file_read_link</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *filename,
86
<a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="returnvalue">GError</span></a> **error);
87
<span class="returnvalue">int</span> <a class="link" href="glib-File-Utilities.html#g-mkdir-with-parents" title="g_mkdir_with_parents ()">g_mkdir_with_parents</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *pathname,
88
<span class="returnvalue">int</span> mode);
68
<a class="link" href="glib-File-Utilities.html#GFileError" title="enum GFileError">GFileError</a> <a class="link" href="glib-File-Utilities.html#g-file-error-from-errno" title="g_file_error_from_errno ()">g_file_error_from_errno</a> (<a class="link" href="glib-Basic-Types.html#gint" title="gint">gint</a> err_no);
69
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean">gboolean</a> <a class="link" href="glib-File-Utilities.html#g-file-get-contents" title="g_file_get_contents ()">g_file_get_contents</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
70
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> **contents,
71
<a class="link" href="glib-Basic-Types.html#gsize" title="gsize">gsize</a> *length,
72
<a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);
73
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean">gboolean</a> <a class="link" href="glib-File-Utilities.html#g-file-set-contents" title="g_file_set_contents ()">g_file_set_contents</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
74
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *contents,
75
<a class="link" href="glib-Basic-Types.html#gssize" title="gssize">gssize</a> length,
76
<a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);
77
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean">gboolean</a> <a class="link" href="glib-File-Utilities.html#g-file-test" title="g_file_test ()">g_file_test</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
78
<a class="link" href="glib-File-Utilities.html#GFileTest" title="enum GFileTest">GFileTest</a> test);
79
<a class="link" href="glib-Basic-Types.html#gint" title="gint">gint</a> <a class="link" href="glib-File-Utilities.html#g-mkstemp" title="g_mkstemp ()">g_mkstemp</a> (<a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *tmpl);
80
<a class="link" href="glib-Basic-Types.html#gint" title="gint">gint</a> <a class="link" href="glib-File-Utilities.html#g-mkstemp-full" title="g_mkstemp_full ()">g_mkstemp_full</a> (<a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *tmpl,
83
<a class="link" href="glib-Basic-Types.html#gint" title="gint">gint</a> <a class="link" href="glib-File-Utilities.html#g-file-open-tmp" title="g_file_open_tmp ()">g_file_open_tmp</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *tmpl,
84
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> **name_used,
85
<a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);
86
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> * <a class="link" href="glib-File-Utilities.html#g-file-read-link" title="g_file_read_link ()">g_file_read_link</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
87
<a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);
88
int <a class="link" href="glib-File-Utilities.html#g-mkdir-with-parents" title="g_mkdir_with_parents ()">g_mkdir_with_parents</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *pathname,
90
91
<a class="link" href="glib-File-Utilities.html#GDir" title="GDir">GDir</a>;
91
<a class="link" href="glib-File-Utilities.html#GDir" title="GDir"><span class="returnvalue">GDir</span></a> * <a class="link" href="glib-File-Utilities.html#g-dir-open" title="g_dir_open ()">g_dir_open</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *path,
92
<a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a> flags,
93
<a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="returnvalue">GError</span></a> **error);
94
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * <a class="link" href="glib-File-Utilities.html#g-dir-read-name" title="g_dir_read_name ()">g_dir_read_name</a> (<a class="link" href="glib-File-Utilities.html#GDir" title="GDir"><span class="returnvalue">GDir</span></a> *dir);
95
<span class="returnvalue">void</span> <a class="link" href="glib-File-Utilities.html#g-dir-rewind" title="g_dir_rewind ()">g_dir_rewind</a> (<a class="link" href="glib-File-Utilities.html#GDir" title="GDir"><span class="returnvalue">GDir</span></a> *dir);
96
<span class="returnvalue">void</span> <a class="link" href="glib-File-Utilities.html#g-dir-close" title="g_dir_close ()">g_dir_close</a> (<a class="link" href="glib-File-Utilities.html#GDir" title="GDir"><span class="returnvalue">GDir</span></a> *dir);
92
<a class="link" href="glib-File-Utilities.html#GDir" title="GDir">GDir</a> * <a class="link" href="glib-File-Utilities.html#g-dir-open" title="g_dir_open ()">g_dir_open</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *path,
93
<a class="link" href="glib-Basic-Types.html#guint" title="guint">guint</a> flags,
94
<a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);
95
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> * <a class="link" href="glib-File-Utilities.html#g-dir-read-name" title="g_dir_read_name ()">g_dir_read_name</a> (<a class="link" href="glib-File-Utilities.html#GDir" title="GDir">GDir</a> *dir);
96
void <a class="link" href="glib-File-Utilities.html#g-dir-rewind" title="g_dir_rewind ()">g_dir_rewind</a> (<a class="link" href="glib-File-Utilities.html#GDir" title="GDir">GDir</a> *dir);
97
void <a class="link" href="glib-File-Utilities.html#g-dir-close" title="g_dir_close ()">g_dir_close</a> (<a class="link" href="glib-File-Utilities.html#GDir" title="GDir">GDir</a> *dir);
98
99
<a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile">GMappedFile</a>;
99
<a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="returnvalue">GMappedFile</span></a> * <a class="link" href="glib-File-Utilities.html#g-mapped-file-new" title="g_mapped_file_new ()">g_mapped_file_new</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *filename,
100
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> writable,
101
<a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="returnvalue">GError</span></a> **error);
102
<a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="returnvalue">GMappedFile</span></a> * <a class="link" href="glib-File-Utilities.html#g-mapped-file-ref" title="g_mapped_file_ref ()">g_mapped_file_ref</a> (<a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="returnvalue">GMappedFile</span></a> *file);
103
<span class="returnvalue">void</span> <a class="link" href="glib-File-Utilities.html#g-mapped-file-unref" title="g_mapped_file_unref ()">g_mapped_file_unref</a> (<a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="returnvalue">GMappedFile</span></a> *file);
104
<span class="returnvalue">void</span> <a class="link" href="glib-File-Utilities.html#g-mapped-file-free" title="g_mapped_file_free ()">g_mapped_file_free</a> (<a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="returnvalue">GMappedFile</span></a> *file);
105
<a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a> <a class="link" href="glib-File-Utilities.html#g-mapped-file-get-length" title="g_mapped_file_get_length ()">g_mapped_file_get_length</a> (<a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="returnvalue">GMappedFile</span></a> *file);
106
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * <a class="link" href="glib-File-Utilities.html#g-mapped-file-get-contents" title="g_mapped_file_get_contents ()">g_mapped_file_get_contents</a> (<a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="returnvalue">GMappedFile</span></a> *file);
100
<a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile">GMappedFile</a> * <a class="link" href="glib-File-Utilities.html#g-mapped-file-new" title="g_mapped_file_new ()">g_mapped_file_new</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
101
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean">gboolean</a> writable,
102
<a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);
103
<a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile">GMappedFile</a> * <a class="link" href="glib-File-Utilities.html#g-mapped-file-ref" title="g_mapped_file_ref ()">g_mapped_file_ref</a> (<a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile">GMappedFile</a> *file);
104
void <a class="link" href="glib-File-Utilities.html#g-mapped-file-unref" title="g_mapped_file_unref ()">g_mapped_file_unref</a> (<a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile">GMappedFile</a> *file);
105
void <a class="link" href="glib-File-Utilities.html#g-mapped-file-free" title="g_mapped_file_free ()">g_mapped_file_free</a> (<a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile">GMappedFile</a> *file);
106
<a class="link" href="glib-Basic-Types.html#gsize" title="gsize">gsize</a> <a class="link" href="glib-File-Utilities.html#g-mapped-file-get-length" title="g_mapped_file_get_length ()">g_mapped_file_get_length</a> (<a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile">GMappedFile</a> *file);
107
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> * <a class="link" href="glib-File-Utilities.html#g-mapped-file-get-contents" title="g_mapped_file_get_contents ()">g_mapped_file_get_contents</a> (<a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile">GMappedFile</a> *file);
108
<span class="returnvalue">int</span> <a class="link" href="glib-File-Utilities.html#g-open" title="g_open ()">g_open</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *filename,
109
<span class="returnvalue">int</span> flags,
110
<span class="returnvalue">int</span> mode);
111
<span class="returnvalue">int</span> <a class="link" href="glib-File-Utilities.html#g-rename" title="g_rename ()">g_rename</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *oldfilename,
112
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *newfilename);
113
<span class="returnvalue">int</span> <a class="link" href="glib-File-Utilities.html#g-mkdir" title="g_mkdir ()">g_mkdir</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *filename,
114
<span class="returnvalue">int</span> mode);
115
<span class="returnvalue">int</span> <a class="link" href="glib-File-Utilities.html#g-stat" title="g_stat ()">g_stat</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *filename,
116
<span class="returnvalue">struct _g_stat_struct</span> *buf);
117
<span class="returnvalue">int</span> <a class="link" href="glib-File-Utilities.html#g-lstat" title="g_lstat ()">g_lstat</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *filename,
118
<span class="returnvalue">struct _g_stat_struct</span> *buf);
119
<span class="returnvalue">int</span> <a class="link" href="glib-File-Utilities.html#g-unlink" title="g_unlink ()">g_unlink</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *filename);
120
<span class="returnvalue">int</span> <a class="link" href="glib-File-Utilities.html#g-remove" title="g_remove ()">g_remove</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *filename);
121
<span class="returnvalue">int</span> <a class="link" href="glib-File-Utilities.html#g-rmdir" title="g_rmdir ()">g_rmdir</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *filename);
122
<span class="returnvalue">FILE</span> * <a class="link" href="glib-File-Utilities.html#g-fopen" title="g_fopen ()">g_fopen</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *filename,
123
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *mode);
124
<span class="returnvalue">FILE</span> * <a class="link" href="glib-File-Utilities.html#g-freopen" title="g_freopen ()">g_freopen</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *filename,
125
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *mode,
126
<span class="returnvalue">FILE</span> *stream);
127
<span class="returnvalue">int</span> <a class="link" href="glib-File-Utilities.html#g-chmod" title="g_chmod ()">g_chmod</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *filename,
128
<span class="returnvalue">int</span> mode);
129
<span class="returnvalue">int</span> <a class="link" href="glib-File-Utilities.html#g-access" title="g_access ()">g_access</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *filename,
130
<span class="returnvalue">int</span> mode);
131
<span class="returnvalue">int</span> <a class="link" href="glib-File-Utilities.html#g-creat" title="g_creat ()">g_creat</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *filename,
132
<span class="returnvalue">int</span> mode);
133
<span class="returnvalue">int</span> <a class="link" href="glib-File-Utilities.html#g-chdir" title="g_chdir ()">g_chdir</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *path);
134
<span class="returnvalue">int</span> <a class="link" href="glib-File-Utilities.html#g-utime" title="g_utime ()">g_utime</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *filename,
135
<span class="returnvalue">struct utimbuf</span> *utb);
109
int <a class="link" href="glib-File-Utilities.html#g-open" title="g_open ()">g_open</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
112
int <a class="link" href="glib-File-Utilities.html#g-rename" title="g_rename ()">g_rename</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *oldfilename,
113
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *newfilename);
114
int <a class="link" href="glib-File-Utilities.html#g-mkdir" title="g_mkdir ()">g_mkdir</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
116
int <a class="link" href="glib-File-Utilities.html#g-stat" title="g_stat ()">g_stat</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
117
struct _g_stat_struct *buf);
118
int <a class="link" href="glib-File-Utilities.html#g-lstat" title="g_lstat ()">g_lstat</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
119
struct _g_stat_struct *buf);
120
int <a class="link" href="glib-File-Utilities.html#g-unlink" title="g_unlink ()">g_unlink</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename);
121
int <a class="link" href="glib-File-Utilities.html#g-remove" title="g_remove ()">g_remove</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename);
122
int <a class="link" href="glib-File-Utilities.html#g-rmdir" title="g_rmdir ()">g_rmdir</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename);
123
FILE * <a class="link" href="glib-File-Utilities.html#g-fopen" title="g_fopen ()">g_fopen</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
124
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *mode);
125
FILE * <a class="link" href="glib-File-Utilities.html#g-freopen" title="g_freopen ()">g_freopen</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
126
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *mode,
128
int <a class="link" href="glib-File-Utilities.html#g-chmod" title="g_chmod ()">g_chmod</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
130
int <a class="link" href="glib-File-Utilities.html#g-access" title="g_access ()">g_access</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
132
int <a class="link" href="glib-File-Utilities.html#g-creat" title="g_creat ()">g_creat</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
134
int <a class="link" href="glib-File-Utilities.html#g-chdir" title="g_chdir ()">g_chdir</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *path);
135
int <a class="link" href="glib-File-Utilities.html#g-utime" title="g_utime ()">g_utime</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
136
struct utimbuf *utb);
138
139
<div class="refsect1" title="Description">
265
<td><p><a name="G-FILE-ERROR-NODEV:CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_NODEV</code></span></p></td>
266
<td><p><a name="G-FILE-ERROR-NODEV--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_NODEV</code></span></p></td>
266
267
<td>This file is of a type that doesn't support
271
<td><p><a name="G-FILE-ERROR-ROFS:CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_ROFS</code></span></p></td>
272
<td><p><a name="G-FILE-ERROR-ROFS--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_ROFS</code></span></p></td>
272
273
<td>The directory containing the new link can't be
273
274
modified because it's on a read-only file system.
277
<td><p><a name="G-FILE-ERROR-TXTBSY:CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_TXTBSY</code></span></p></td>
278
<td><p><a name="G-FILE-ERROR-TXTBSY--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_TXTBSY</code></span></p></td>
278
279
<td>Text file busy.
282
<td><p><a name="G-FILE-ERROR-FAULT:CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_FAULT</code></span></p></td>
283
<td><p><a name="G-FILE-ERROR-FAULT--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_FAULT</code></span></p></td>
283
284
<td>You passed in a pointer to bad memory.
284
285
(GLib won't reliably return this, don't pass in pointers to bad
289
<td><p><a name="G-FILE-ERROR-LOOP:CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_LOOP</code></span></p></td>
290
<td><p><a name="G-FILE-ERROR-LOOP--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_LOOP</code></span></p></td>
290
291
<td>Too many levels of symbolic links were encountered
291
292
in looking up a file name. This often indicates a cycle of symbolic
296
<td><p><a name="G-FILE-ERROR-NOSPC:CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_NOSPC</code></span></p></td>
297
<td><p><a name="G-FILE-ERROR-NOSPC--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_NOSPC</code></span></p></td>
297
298
<td>No space left on device; write operation on a
298
299
file failed because the disk is full.
302
<td><p><a name="G-FILE-ERROR-NOMEM:CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_NOMEM</code></span></p></td>
303
<td><p><a name="G-FILE-ERROR-NOMEM--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_NOMEM</code></span></p></td>
303
304
<td>No memory available. The system cannot allocate
304
305
more virtual memory because its capacity is full.
308
<td><p><a name="G-FILE-ERROR-MFILE:CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_MFILE</code></span></p></td>
309
<td><p><a name="G-FILE-ERROR-MFILE--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_MFILE</code></span></p></td>
309
310
<td>The current process has too many files open and
310
311
can't open any more. Duplicate descriptors do count toward this
315
<td><p><a name="G-FILE-ERROR-NFILE:CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_NFILE</code></span></p></td>
316
<td><p><a name="G-FILE-ERROR-NFILE--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_NFILE</code></span></p></td>
316
317
<td>There are too many distinct file openings in the
321
<td><p><a name="G-FILE-ERROR-BADF:CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_BADF</code></span></p></td>
322
<td><p><a name="G-FILE-ERROR-BADF--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_BADF</code></span></p></td>
322
323
<td>Bad file descriptor; for example, I/O on a
323
324
descriptor that has been closed or reading from a descriptor open
324
325
only for writing (or vice versa).
328
<td><p><a name="G-FILE-ERROR-INVAL:CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_INVAL</code></span></p></td>
329
<td><p><a name="G-FILE-ERROR-INVAL--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_INVAL</code></span></p></td>
329
330
<td>Invalid argument. This is used to indicate
330
331
various kinds of problems with passing the wrong argument to a
331
332
library function.
335
<td><p><a name="G-FILE-ERROR-PIPE:CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_PIPE</code></span></p></td>
336
<td><p><a name="G-FILE-ERROR-PIPE--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_PIPE</code></span></p></td>
336
337
<td>Broken pipe; there is no process reading from the
337
338
other end of a pipe. Every library function that returns this
338
339
error code also generates a `SIGPIPE' signal; this signal
607
610
<div class="refsect2" title="g_file_test ()">
608
611
<a name="g-file-test"></a><h3>g_file_test ()</h3>
609
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_file_test (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *filename,
610
<a class="link" href="glib-File-Utilities.html#GFileTest" title="enum GFileTest"><span class="returnvalue">GFileTest</span></a> test);</pre>
612
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean">gboolean</a> g_file_test (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
613
<a class="link" href="glib-File-Utilities.html#GFileTest" title="enum GFileTest">GFileTest</a> test);</pre>
612
Returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if any of the tests in the bitfield <em class="parameter"><code>test</code></em> are
613
<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 |
614
G_FILE_TEST_IS_DIR)</code> will return <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the file exists;
615
Returns <a class="link" href="glib-Standard-Macros.html#TRUE--CAPS" title="TRUE"><code class="literal">TRUE</code></a> if any of the tests in the bitfield <em class="parameter"><code>test</code></em> are
616
<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 |
617
G_FILE_TEST_IS_DIR)</code> will return <a class="link" href="glib-Standard-Macros.html#TRUE--CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the file exists;
615
618
the check whether it's a directory doesn't matter since the existence
616
test is <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>. With the current set of available tests, there's no point
619
test is <a class="link" href="glib-Standard-Macros.html#TRUE--CAPS" title="TRUE"><code class="literal">TRUE</code></a>. With the current set of available tests, there's no point
617
620
passing in more than one test at a time.
620
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,
623
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,
621
624
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
622
<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>.
625
<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>.
625
628
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
626
<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.
629
<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.
629
632
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
630
633
to perform an operation, because there is always the possibility
631
634
of the condition changing before you actually perform the operation.
632
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>
635
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>
633
636
to know whether it is safe to write to a file without being
634
637
tricked into writing into a different location. It doesn't work!