~ubuntu-branches/ubuntu/trusty/glib2.0/trusty-proposed

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>File Utilities</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.1">
<link rel="home" href="index.html" title="GLib Reference Manual">
<link rel="up" href="glib-utilities.html" title="GLib Utilities">
<link rel="prev" href="glib-Spawning-Processes.html" title="Spawning Processes">
<link rel="next" href="glib-URI-Functions.html" title="URI Functions">
<meta name="generator" content="GTK-Doc V1.11 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="glib.html" title="GLib Overview">
<link rel="chapter" href="glib-fundamentals.html" title="GLib Fundamentals">
<link rel="chapter" href="glib-core.html" title="GLib Core Application Support">
<link rel="chapter" href="glib-utilities.html" title="GLib Utilities">
<link rel="chapter" href="glib-data-types.html" title="GLib Data Types">
<link rel="chapter" href="tools.html" title="GLib Tools">
<link rel="index" href="api-index-full.html" title="Index">
<link rel="index" href="api-index-deprecated.html" title="Index of deprecated symbols">
<link rel="index" href="api-index-2-2.html" title="Index of new symbols in 2.2">
<link rel="index" href="api-index-2-4.html" title="Index of new symbols in 2.4">
<link rel="index" href="api-index-2-6.html" title="Index of new symbols in 2.6">
<link rel="index" href="api-index-2-8.html" title="Index of new symbols in 2.8">
<link rel="index" href="api-index-2-10.html" title="Index of new symbols in 2.10">
<link rel="index" href="api-index-2-12.html" title="Index of new symbols in 2.12">
<link rel="index" href="api-index-2-14.html" title="Index of new symbols in 2.14">
<link rel="index" href="api-index-2-16.html" title="Index of new symbols in 2.16">
<link rel="index" href="api-index-2-18.html" title="Index of new symbols in 2.18">
<link rel="index" href="api-index-2-20.html" title="Index of new symbols in 2.20">
<link rel="index" href="api-index-2-22.html" title="Index of new symbols in 2.22">
<link rel="index" href="api-index-2-24.html" title="Index of new symbols in 2.24">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="glib-Spawning-Processes.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="glib-utilities.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GLib Reference Manual</th>
<td><a accesskey="n" href="glib-URI-Functions.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#glib-File-Utilities.synopsis" class="shortcut">Top</a>
                 | 
                <a href="#glib-File-Utilities.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry" title="File Utilities">
<a name="glib-File-Utilities"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="glib-File-Utilities.top_of_page"></a>File Utilities</span></h2>
<p>File Utilities — various file-related functions</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv" title="Synopsis">
<a name="glib-File-Utilities.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">

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

enum                <a class="link" href="glib-File-Utilities.html#GFileError" title="enum GFileError">GFileError</a>;
#define             <a class="link" href="glib-File-Utilities.html#G-FILE-ERROR--CAPS" title="G_FILE_ERROR">G_FILE_ERROR</a>
enum                <a class="link" href="glib-File-Utilities.html#GFileTest" title="enum GFileTest">GFileTest</a>;
<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);
<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,
                                                         <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> **contents,
                                                         <a class="link" href="glib-Basic-Types.html#gsize" title="gsize">gsize</a> *length,
                                                         <a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);
<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,
                                                         const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *contents,
                                                         <a class="link" href="glib-Basic-Types.html#gssize" title="gssize">gssize</a> length,
                                                         <a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);
<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,
                                                         <a class="link" href="glib-File-Utilities.html#GFileTest" title="enum GFileTest">GFileTest</a> test);
<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);
<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,
                                                         int flags,
                                                         int mode);
<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,
                                                         <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> **name_used,
                                                         <a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);
<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,
                                                         <a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);
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,
                                                         int mode);

                    <a class="link" href="glib-File-Utilities.html#GDir" title="GDir">GDir</a>;
<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,
                                                         <a class="link" href="glib-Basic-Types.html#guint" title="guint">guint</a> flags,
                                                         <a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);
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);
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);
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);

                    <a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile">GMappedFile</a>;
<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,
                                                         <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean">gboolean</a> writable,
                                                         <a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);
<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);
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);
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);
<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);
<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);

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,
                                                         int flags,
                                                         int mode);
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,
                                                         const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *newfilename);
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,
                                                         int mode);
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,
                                                         struct _g_stat_struct *buf);
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,
                                                         struct _g_stat_struct *buf);
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);
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);
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);
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,
                                                         const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *mode);
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,
                                                         const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *mode,
                                                         FILE *stream);
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,
                                                         int mode);
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,
                                                         int mode);
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,
                                                         int mode);
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);
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,
                                                         struct utimbuf *utb);
</pre>
</div>
<div class="refsect1" title="Description">
<a name="glib-File-Utilities.description"></a><h2>Description</h2>
<p>
There is a group of functions which wrap the common POSIX functions
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>,
<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
wrappers is to make it possible to handle file names with any Unicode
characters in them on Windows without having to use ifdefs and the
wide character API in the application code.
</p>
<p>
The pathname argument should be in the GLib file name encoding. On
POSIX this is the actual on-disk encoding which might correspond to
the locale settings of the process (or the
<code class="envar">G_FILENAME_ENCODING</code> environment variable), or not.
</p>
<p>
On Windows the GLib file name encoding is UTF-8. Note that the
Microsoft C library does not use UTF-8, but has separate APIs for
current system code page and wide characters (UTF-16). The GLib
wrappers call the wide character API if present (on modern Windows
systems), otherwise convert to/from the system code page.
</p>
<p>
Another group of functions allows to open and read directories
in the GLib file name encoding. These are <a class="link" href="glib-File-Utilities.html#g-dir-open" title="g_dir_open ()"><code class="function">g_dir_open()</code></a>,
<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>
</div>
<div class="refsect1" title="Details">
<a name="glib-File-Utilities.details"></a><h2>Details</h2>
<div class="refsect2" title="enum GFileError">
<a name="GFileError"></a><h3>enum GFileError</h3>
<pre class="programlisting">typedef enum
{
  G_FILE_ERROR_EXIST,
  G_FILE_ERROR_ISDIR,
  G_FILE_ERROR_ACCES,
  G_FILE_ERROR_NAMETOOLONG,
  G_FILE_ERROR_NOENT,
  G_FILE_ERROR_NOTDIR,
  G_FILE_ERROR_NXIO,
  G_FILE_ERROR_NODEV,
  G_FILE_ERROR_ROFS,
  G_FILE_ERROR_TXTBSY,
  G_FILE_ERROR_FAULT,
  G_FILE_ERROR_LOOP,
  G_FILE_ERROR_NOSPC,
  G_FILE_ERROR_NOMEM,
  G_FILE_ERROR_MFILE,
  G_FILE_ERROR_NFILE,
  G_FILE_ERROR_BADF,
  G_FILE_ERROR_INVAL,
  G_FILE_ERROR_PIPE,
  G_FILE_ERROR_AGAIN,
  G_FILE_ERROR_INTR,
  G_FILE_ERROR_IO,
  G_FILE_ERROR_PERM,
  G_FILE_ERROR_NOSYS,
  G_FILE_ERROR_FAILED
} GFileError;
</pre>
<p>
Values corresponding to <code class="literal">errno</code> codes returned from file operations
on UNIX. Unlike <code class="literal">errno</code> codes, <a class="link" href="glib-File-Utilities.html#GFileError" title="enum GFileError"><span class="type">GFileError</span></a> values are available on
all systems, even Windows. The exact meaning of each code depends on what
sort of file operation you were performing; the UNIX documentation
gives more details. The following error code descriptions come
from the GNU C Library manual, and are under the copyright
of that manual.
</p>
<p>
It's not very portable to make detailed assumptions about exactly
which errors will be returned from a given operation. Some errors
don't occur on some systems, etc., sometimes there are subtle
differences in when a system will report a given error, etc.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><a name="G-FILE-ERROR-EXIST--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_EXIST</code></span></p></td>
<td>Operation not permitted; only the owner of the
     file (or other resource) or processes with special privileges can
     perform the operation.
</td>
</tr>
<tr>
<td><p><a name="G-FILE-ERROR-ISDIR--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_ISDIR</code></span></p></td>
<td>File is a directory; you cannot open a directory
     for writing, or create or remove hard links to it.
</td>
</tr>
<tr>
<td><p><a name="G-FILE-ERROR-ACCES--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_ACCES</code></span></p></td>
<td>Permission denied; the file permissions do not
     allow the attempted operation.
</td>
</tr>
<tr>
<td><p><a name="G-FILE-ERROR-NAMETOOLONG--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_NAMETOOLONG</code></span></p></td>
<td>Filename too long.
</td>
</tr>
<tr>
<td><p><a name="G-FILE-ERROR-NOENT--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_NOENT</code></span></p></td>
<td>No such file or directory.  This is a "file
     doesn't exist" error for ordinary files that are referenced in
     contexts where they are expected to already exist.
</td>
</tr>
<tr>
<td><p><a name="G-FILE-ERROR-NOTDIR--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_NOTDIR</code></span></p></td>
<td>A file that isn't a directory was specified when
     a directory is required.
</td>
</tr>
<tr>
<td><p><a name="G-FILE-ERROR-NXIO--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_NXIO</code></span></p></td>
<td>No such device or address.  The system tried to
     use the device represented by a file you specified, and it
     couldn't find the device.  This can mean that the device file was
     installed incorrectly, or that the physical device is missing or
     not correctly attached to the computer.
</td>
</tr>
<tr>
<td><p><a name="G-FILE-ERROR-NODEV--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_NODEV</code></span></p></td>
<td>This file is of a type that doesn't support
     mapping.
</td>
</tr>
<tr>
<td><p><a name="G-FILE-ERROR-ROFS--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_ROFS</code></span></p></td>
<td>The directory containing the new link can't be
          modified because it's on a read-only file system.
</td>
</tr>
<tr>
<td><p><a name="G-FILE-ERROR-TXTBSY--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_TXTBSY</code></span></p></td>
<td>Text file busy.
</td>
</tr>
<tr>
<td><p><a name="G-FILE-ERROR-FAULT--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_FAULT</code></span></p></td>
<td>You passed in a pointer to bad memory.
  (GLib won't reliably return this, don't pass in pointers to bad
  memory.)
</td>
</tr>
<tr>
<td><p><a name="G-FILE-ERROR-LOOP--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_LOOP</code></span></p></td>
<td>Too many levels of symbolic links were encountered
  in looking up a file name.  This often indicates a cycle of symbolic
  links.
</td>
</tr>
<tr>
<td><p><a name="G-FILE-ERROR-NOSPC--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_NOSPC</code></span></p></td>
<td>No space left on device; write operation on a
  file failed because the disk is full.
</td>
</tr>
<tr>
<td><p><a name="G-FILE-ERROR-NOMEM--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_NOMEM</code></span></p></td>
<td>No memory available.  The system cannot allocate
     more virtual memory because its capacity is full.
</td>
</tr>
<tr>
<td><p><a name="G-FILE-ERROR-MFILE--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_MFILE</code></span></p></td>
<td>The current process has too many files open and
     can't open any more.  Duplicate descriptors do count toward this
     limit.
</td>
</tr>
<tr>
<td><p><a name="G-FILE-ERROR-NFILE--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_NFILE</code></span></p></td>
<td>There are too many distinct file openings in the
     entire system.
</td>
</tr>
<tr>
<td><p><a name="G-FILE-ERROR-BADF--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_BADF</code></span></p></td>
<td>Bad file descriptor; for example, I/O on a
     descriptor that has been closed or reading from a descriptor open
     only for writing (or vice versa).
</td>
</tr>
<tr>
<td><p><a name="G-FILE-ERROR-INVAL--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_INVAL</code></span></p></td>
<td>Invalid argument.  This is used to indicate
     various kinds of problems with passing the wrong argument to a
     library function.
</td>
</tr>
<tr>
<td><p><a name="G-FILE-ERROR-PIPE--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_PIPE</code></span></p></td>
<td>Broken pipe; there is no process reading from the
     other end of a pipe.  Every library function that returns this
     error code also generates a `SIGPIPE' signal; this signal
     terminates the program if not handled or blocked.  Thus, your
     program will never actually see this code unless it has handled or
     blocked `SIGPIPE'.
</td>
</tr>
<tr>
<td><p><a name="G-FILE-ERROR-AGAIN--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_AGAIN</code></span></p></td>
<td>Resource temporarily unavailable; the call might
     work if you try again later.
</td>
</tr>
<tr>
<td><p><a name="G-FILE-ERROR-INTR--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_INTR</code></span></p></td>
<td>Interrupted function call; an asynchronous signal
     occurred and prevented completion of the call.  When this
     happens, you should try the call again.
</td>
</tr>
<tr>
<td><p><a name="G-FILE-ERROR-IO--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_IO</code></span></p></td>
<td>Input/output error; usually used for physical read
    or write errors. i.e. the disk or other physical device hardware
    is returning errors.
</td>
</tr>
<tr>
<td><p><a name="G-FILE-ERROR-PERM--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_PERM</code></span></p></td>
<td>Operation not permitted; only the owner of the
     file (or other resource) or processes with special privileges can
     perform the operation.
</td>
</tr>
<tr>
<td><p><a name="G-FILE-ERROR-NOSYS--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_NOSYS</code></span></p></td>
<td>Function not implemented; this indicates that the
    system is missing some functionality.
</td>
</tr>
<tr>
<td><p><a name="G-FILE-ERROR-FAILED--CAPS"></a><span class="term"><code class="literal">G_FILE_ERROR_FAILED</code></span></p></td>
<td>Does not correspond to a UNIX error code; this
  is the standard "failed for unspecified reason" error code present in
  all <a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="type">GError</span></a> error code enumerations. Returned if no specific
  code applies.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="G_FILE_ERROR">
<a name="G-FILE-ERROR--CAPS"></a><h3>G_FILE_ERROR</h3>
<pre class="programlisting">#define G_FILE_ERROR g_file_error_quark ()
</pre>
<p>
Error domain for file operations. Errors in this domain will
be from the <a class="link" href="glib-File-Utilities.html#GFileError" title="enum GFileError"><span class="type">GFileError</span></a> enumeration. See <a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="type">GError</span></a> for information on
error domains.
</p>
</div>
<hr>
<div class="refsect2" title="enum GFileTest">
<a name="GFileTest"></a><h3>enum GFileTest</h3>
<pre class="programlisting">typedef enum
{
  G_FILE_TEST_IS_REGULAR    = 1 &lt;&lt; 0,
  G_FILE_TEST_IS_SYMLINK    = 1 &lt;&lt; 1,
  G_FILE_TEST_IS_DIR        = 1 &lt;&lt; 2,
  G_FILE_TEST_IS_EXECUTABLE = 1 &lt;&lt; 3,
  G_FILE_TEST_EXISTS        = 1 &lt;&lt; 4
} GFileTest;
</pre>
<p>
A test to perform on a file using <a class="link" href="glib-File-Utilities.html#g-file-test" title="g_file_test ()"><code class="function">g_file_test()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><a name="G-FILE-TEST-IS-REGULAR--CAPS"></a><span class="term"><code class="literal">G_FILE_TEST_IS_REGULAR</code></span></p></td>
<td>%TRUE if the file is a regular file (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> if the tested file is a symlink
    to a regular file.
</td>
</tr>
<tr>
<td><p><a name="G-FILE-TEST-IS-SYMLINK--CAPS"></a><span class="term"><code class="literal">G_FILE_TEST_IS_SYMLINK</code></span></p></td>
<td>%TRUE if the file is a symlink.
</td>
</tr>
<tr>
<td><p><a name="G-FILE-TEST-IS-DIR--CAPS"></a><span class="term"><code class="literal">G_FILE_TEST_IS_DIR</code></span></p></td>
<td>%TRUE if the file is a directory.
</td>
</tr>
<tr>
<td><p><a name="G-FILE-TEST-IS-EXECUTABLE--CAPS"></a><span class="term"><code class="literal">G_FILE_TEST_IS_EXECUTABLE</code></span></p></td>
<td>%TRUE if the file is executable.
</td>
</tr>
<tr>
<td><p><a name="G-FILE-TEST-EXISTS--CAPS"></a><span class="term"><code class="literal">G_FILE_TEST_EXISTS</code></span></p></td>
<td>%TRUE if the file exists. 
    It may or may not be a regular file.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="g_file_error_from_errno ()">
<a name="g-file-error-from-errno"></a><h3>g_file_error_from_errno ()</h3>
<pre class="programlisting"><a class="link" href="glib-File-Utilities.html#GFileError" title="enum GFileError">GFileError</a>          g_file_error_from_errno             (<a class="link" href="glib-Basic-Types.html#gint" title="gint">gint</a> err_no);</pre>
<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>errno</code></em>.
For example, if you pass in <code class="literal">EEXIST</code> this function returns
<a class="link" href="glib-File-Utilities.html#G-FILE-ERROR-EXIST--CAPS"><span class="type">G_FILE_ERROR_EXIST</span></a>. Unlike <em class="parameter"><code>errno</code></em> values, you can portably
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>
<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="GError"><span class="type">GError</span></a> returned
from a function that manipulates files. So you would use
<a class="link" href="glib-File-Utilities.html#g-file-error-from-errno" title="g_file_error_from_errno ()"><code class="function">g_file_error_from_errno()</code></a> when constructing a <a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="type">GError</span></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>err_no</code></em> :</span></p></td>
<td> an "errno" value
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> <a class="link" href="glib-File-Utilities.html#GFileError" title="enum GFileError"><span class="type">GFileError</span></a> corresponding to the given <em class="parameter"><code>errno</code></em>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="g_file_get_contents ()">
<a name="g-file-get-contents"></a><h3>g_file_get_contents ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean">gboolean</a>            g_file_get_contents                 (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
                                                         <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> **contents,
                                                         <a class="link" href="glib-Basic-Types.html#gsize" title="gsize">gsize</a> *length,
                                                         <a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);</pre>
<p>
Reads an entire file into allocated memory, with good error
checking.
</p>
<p>
If the call was successful, it returns <a class="link" href="glib-Standard-Macros.html#TRUE--CAPS" title="TRUE"><code class="literal">TRUE</code></a> and sets <em class="parameter"><code>contents</code></em> to the file
contents and <em class="parameter"><code>length</code></em> to the length of the file contents in bytes. The string
stored in <em class="parameter"><code>contents</code></em> will be nul-terminated, so for text files you can pass
<a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a> for the <em class="parameter"><code>length</code></em> argument. If the call was not successful, it returns
<a class="link" href="glib-Standard-Macros.html#FALSE--CAPS" title="FALSE"><code class="literal">FALSE</code></a> and sets <em class="parameter"><code>error</code></em>. The error domain is <a class="link" href="glib-File-Utilities.html#G-FILE-ERROR--CAPS" title="G_FILE_ERROR"><span class="type">G_FILE_ERROR</span></a>. Possible error
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,
<em class="parameter"><code>contents</code></em> is set to <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a> and <em class="parameter"><code>length</code></em> is set to zero.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
<td> name of a file to read contents from, in the GLib file name encoding
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>contents</code></em> :</span></p></td>
<td> 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
    the returned string
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>length</code></em> :</span></p></td>
<td> location to store length in bytes of the contents, or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td> return location for a <a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="type">GError</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> <a class="link" href="glib-Standard-Macros.html#TRUE--CAPS" title="TRUE"><code class="literal">TRUE</code></a> on success, <a class="link" href="glib-Standard-Macros.html#FALSE--CAPS" title="FALSE"><code class="literal">FALSE</code></a> if an error occurred
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="g_file_set_contents ()">
<a name="g-file-set-contents"></a><h3>g_file_set_contents ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean">gboolean</a>            g_file_set_contents                 (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
                                                         const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *contents,
                                                         <a class="link" href="glib-Basic-Types.html#gssize" title="gssize">gssize</a> length,
                                                         <a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);</pre>
<p>
Writes all of <em class="parameter"><code>contents</code></em> to a file named <em class="parameter"><code>filename</code></em>, with good error checking.
If a file called <em class="parameter"><code>filename</code></em> already exists it will be overwritten.
</p>
<p>
This write is atomic in the sense that it is first written to a temporary
file which is then renamed to the final name. Notes:
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
   On Unix, if <em class="parameter"><code>filename</code></em> already exists hard links to <em class="parameter"><code>filename</code></em> will break.
   Also since the file is recreated, existing permissions, access control
   lists, metadata etc. may be lost. If <em class="parameter"><code>filename</code></em> is a symbolic link,
   the link itself will be replaced, not the linked file.
</li>
<li class="listitem">
  On Windows renaming a file will not remove an existing file with the
  new name, so on Windows there is a race condition between the existing
  file being removed and the temporary file being renamed.
</li>
<li class="listitem">
  On Windows there is no way to remove a file that is open to some
  process, or mapped into memory. Thus, this function will fail if
  <em class="parameter"><code>filename</code></em> already exists and is open.
</li>
</ul></div>
<p>
</p>
<p>
If the call was sucessful, it returns <a class="link" href="glib-Standard-Macros.html#TRUE--CAPS" title="TRUE"><code class="literal">TRUE</code></a>. If the call was not successful,
it returns <a class="link" href="glib-Standard-Macros.html#FALSE--CAPS" title="FALSE"><code class="literal">FALSE</code></a> and sets <em class="parameter"><code>error</code></em>. The error domain is <a class="link" href="glib-File-Utilities.html#G-FILE-ERROR--CAPS" title="G_FILE_ERROR"><span class="type">G_FILE_ERROR</span></a>.
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>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
<td> name of a file to write <em class="parameter"><code>contents</code></em> to, in the GLib file name
  encoding
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>contents</code></em> :</span></p></td>
<td> string to write to the file
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>length</code></em> :</span></p></td>
<td> length of <em class="parameter"><code>contents</code></em>, or -1 if <em class="parameter"><code>contents</code></em> is a nul-terminated string
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td> return location for a <a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="type">GError</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> <a class="link" href="glib-Standard-Macros.html#TRUE--CAPS" title="TRUE"><code class="literal">TRUE</code></a> on success, <a class="link" href="glib-Standard-Macros.html#FALSE--CAPS" title="FALSE"><code class="literal">FALSE</code></a> if an error occurred

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.8</p>
</div>
<hr>
<div class="refsect2" title="g_file_test ()">
<a name="g-file-test"></a><h3>g_file_test ()</h3>
<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,
                                                         <a class="link" href="glib-File-Utilities.html#GFileTest" title="enum GFileTest">GFileTest</a> test);</pre>
<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> are
<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> 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 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 the current set of available tests, there's no point
passing in more than one test at a time.
</p>
<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,
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
<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>
<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
<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>
<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
to perform an operation, because there is always the possibility
of the condition changing before you actually perform the operation.
For example, you might think you could use <a class="link" href="glib-File-Utilities.html#G-FILE-TEST-IS-SYMLINK--CAPS"><code class="literal">G_FILE_TEST_IS_SYMLINK</code></a>
to know whether it is safe to write to a file without being
tricked into writing into a different location. It doesn't work!
</p>
<div class="informalexample"><pre class="programlisting">
/* DON'T DO THIS */
 if (!g_file_test (filename, G_FILE_TEST_IS_SYMLINK)) 
   {
     fd = g_open (filename, O_WRONLY);
     /* write to fd */
   }
</pre></div>
<p>
</p>
<p>
Another thing to note is that <a class="link" href="glib-File-Utilities.html#G-FILE-TEST-EXISTS--CAPS"><code class="literal">G_FILE_TEST_EXISTS</code></a> and
<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>
system call. This usually doesn't matter, but if your program
is setuid or setgid it means that these tests will give you
the answer for the real user ID and group ID, rather than the
effective user ID and group ID.
</p>
<p>
On Windows, there are no symlinks, so testing for
<a 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
<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
its name indicates that it is executable, checking for well-known
extensions and those listed in the <code class="literal">PATHEXT</code> environment variable.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
<td> a filename to test in the GLib file name encoding
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>test</code></em> :</span></p></td>
<td> bitfield of <a class="link" href="glib-File-Utilities.html#GFileTest" title="enum GFileTest"><span class="type">GFileTest</span></a> flags
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> whether a test was <a class="link" href="glib-Standard-Macros.html#TRUE--CAPS" title="TRUE"><code class="literal">TRUE</code></a>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="g_mkstemp ()">
<a name="g-mkstemp"></a><h3>g_mkstemp ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint">gint</a>                g_mkstemp                           (<a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *tmpl);</pre>
<p>
Opens a temporary file. See the <code class="function">mkstemp()</code> documentation
on most UNIX-like systems. 
</p>
<p>
The parameter is a string that should follow the rules for
<code class="function">mkstemp()</code> templates, i.e. contain the string "XXXXXX". 
<a 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 sequence does not have to occur at the very end of the 
template. The X string will 
be modified to form the name of a file that didn't exist.
The string should be in the GLib file name encoding. Most importantly, 
on Windows it should be in UTF-8.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>tmpl</code></em> :</span></p></td>
<td> template filename
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> A file handle (as from <code class="function">open()</code>) to the file
opened for reading and writing. The file is opened in binary mode
on platforms where there is a difference. The file handle should be
closed with <code class="function">close()</code>. In case of errors, -1 is returned.  
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="g_mkstemp_full ()">
<a name="g-mkstemp-full"></a><h3>g_mkstemp_full ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint">gint</a>                g_mkstemp_full                      (<a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *tmpl,
                                                         int flags,
                                                         int mode);</pre>
<p>
Opens a temporary file. See the <code class="function">mkstemp()</code> documentation
on most UNIX-like systems.
</p>
<p>
The parameter is a string that should follow the rules for
<code class="function">mkstemp()</code> templates, i.e. contain the string "XXXXXX".
<a 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>
in that the sequence does not have to occur at the very end of the
template and you can pass a <em class="parameter"><code>mode</code></em> and additional <em class="parameter"><code>flags</code></em>. The X
string will be modified to form the name of a file that didn't exist.
The string should be in the GLib file name encoding. Most importantly,
on Windows it should be in UTF-8.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>tmpl</code></em> :</span></p></td>
<td> template filename
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
<td> flags to pass to an <code class="function">open()</code> call in addition to O_EXCL and
        O_CREAT, which are passed automatically
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>mode</code></em> :</span></p></td>
<td> permissios to create the temporary file with
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> A file handle (as from <code class="function">open()</code>) to the file
    opened for reading and writing. The file handle should be
    closed with <code class="function">close()</code>. In case of errors, -1 is returned.

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.22</p>
</div>
<hr>
<div class="refsect2" title="g_file_open_tmp ()">
<a name="g-file-open-tmp"></a><h3>g_file_open_tmp ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint">gint</a>                g_file_open_tmp                     (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *tmpl,
                                                         <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> **name_used,
                                                         <a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);</pre>
<p>
Opens a file for writing in the preferred directory for temporary
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>
<p>
<em class="parameter"><code>tmpl</code></em> should be a string in the GLib file name encoding containing 
a sequence of six 'X' characters, as the parameter to <a class="link" href="glib-File-Utilities.html#g-mkstemp" title="g_mkstemp ()"><code class="function">g_mkstemp()</code></a>.
However, unlike these functions, the template should only be a
basename, no directory components are allowed. If template is
<a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>, a default template is used.
</p>
<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> is not modified, and might thus be a read-only literal string.
</p>
<p>
The actual name used is returned in <em class="parameter"><code>name_used</code></em> if non-<a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>. 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> when not needed any longer.
The returned name is in the GLib file name encoding.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>tmpl</code></em> :</span></p></td>
<td> Template for file name, as in <a class="link" href="glib-File-Utilities.html#g-mkstemp" title="g_mkstemp ()"><code class="function">g_mkstemp()</code></a>, basename only,
       or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>, to a default template
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>name_used</code></em> :</span></p></td>
<td> location to store actual name used, or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td> return location for a <a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="type">GError</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> A file handle (as from <code class="function">open()</code>) to 
the file opened for reading and writing. The file is opened in binary 
mode on platforms where there is a difference. The file handle should be
closed with <code class="function">close()</code>. In case of errors, -1 is returned 
and <em class="parameter"><code>error</code></em> will be set.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="g_file_read_link ()">
<a name="g-file-read-link"></a><h3>g_file_read_link ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *             g_file_read_link                    (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
                                                         <a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);</pre>
<p>
Reads the contents of the symbolic link <em class="parameter"><code>filename</code></em> like the POSIX
<code class="function">readlink()</code> function.  The returned string is in the encoding used
for filenames. Use <a 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>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
<td> the symbolic link
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td> return location for a <a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="type">GError</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> A newly-allocated string with the contents of 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.

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.4</p>
</div>
<hr>
<div class="refsect2" title="g_mkdir_with_parents ()">
<a name="g-mkdir-with-parents"></a><h3>g_mkdir_with_parents ()</h3>
<pre class="programlisting">int                 g_mkdir_with_parents                (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *pathname,
                                                         int mode);</pre>
<p>
Create a directory if it doesn't already exist. Create intermediate
parent directories as needed, too.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>pathname</code></em> :</span></p></td>
<td> a pathname in the GLib file name encoding
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>mode</code></em> :</span></p></td>
<td> permissions to use for newly created directories
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> 0 if the directory already exists, or was successfully
created. Returns -1 if an error occurred, with errno set.

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.8</p>
</div>
<hr>
<div class="refsect2" title="GDir">
<a name="GDir"></a><h3>GDir</h3>
<pre class="programlisting">typedef struct _GDir GDir;</pre>
<p>
An opaque structure representing an opened directory.
</p>
</div>
<hr>
<div class="refsect2" title="g_dir_open ()">
<a name="g-dir-open"></a><h3>g_dir_open ()</h3>
<pre class="programlisting"><a class="link" href="glib-File-Utilities.html#GDir" title="GDir">GDir</a> *              g_dir_open                          (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *path,
                                                         <a class="link" href="glib-Basic-Types.html#guint" title="guint">guint</a> flags,
                                                         <a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);</pre>
<p>
Opens a directory for reading. The names of the files in the
directory can then be retrieved using <a class="link" href="glib-File-Utilities.html#g-dir-read-name" title="g_dir_read_name ()"><code class="function">g_dir_read_name()</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>path</code></em> :</span></p></td>
<td> the path to the directory you are interested in. On Unix
        in the on-disk encoding. On Windows in UTF-8
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
<td> Currently must be set to 0. Reserved for future use.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td> return location for a <a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="type">GError</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>.
        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
        <a class="link" href="glib-File-Utilities.html#g-dir-open" title="g_dir_open ()"><code class="function">g_dir_open()</code></a> fails.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> a newly allocated <a class="link" href="glib-File-Utilities.html#GDir" title="GDir"><span class="type">GDir</span></a> on success, <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a> on failure.
  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>
  when you are finished with it.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="g_dir_read_name ()">
<a name="g-dir-read-name"></a><h3>g_dir_read_name ()</h3>
<pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *       g_dir_read_name                     (<a class="link" href="glib-File-Utilities.html#GDir" title="GDir">GDir</a> *dir);</pre>
<p>
Retrieves the name of the next entry in the directory.  The '.' and
'..' entries are omitted. On Windows, the returned name is in
UTF-8. On Unix, it is in the on-disk encoding.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>dir</code></em> :</span></p></td>
<td> a <a class="link" href="glib-File-Utilities.html#GDir" title="GDir"><span class="type">GDir</span></a>* created by <a class="link" href="glib-File-Utilities.html#g-dir-open" title="g_dir_open ()"><code class="function">g_dir_open()</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> The entry's name or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a> if there are no 
  more entries. The return value is owned by GLib and
  must not be modified or freed.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="g_dir_rewind ()">
<a name="g-dir-rewind"></a><h3>g_dir_rewind ()</h3>
<pre class="programlisting">void                g_dir_rewind                        (<a class="link" href="glib-File-Utilities.html#GDir" title="GDir">GDir</a> *dir);</pre>
<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>
will return the first entry again.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>dir</code></em> :</span></p></td>
<td> a <a class="link" href="glib-File-Utilities.html#GDir" title="GDir"><span class="type">GDir</span></a>* created by <a class="link" href="glib-File-Utilities.html#g-dir-open" title="g_dir_open ()"><code class="function">g_dir_open()</code></a>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="g_dir_close ()">
<a name="g-dir-close"></a><h3>g_dir_close ()</h3>
<pre class="programlisting">void                g_dir_close                         (<a class="link" href="glib-File-Utilities.html#GDir" title="GDir">GDir</a> *dir);</pre>
<p>
Closes the directory and deallocates all related resources.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>dir</code></em> :</span></p></td>
<td> a <a class="link" href="glib-File-Utilities.html#GDir" title="GDir"><span class="type">GDir</span></a>* created by <a class="link" href="glib-File-Utilities.html#g-dir-open" title="g_dir_open ()"><code class="function">g_dir_open()</code></a>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="GMappedFile">
<a name="GMappedFile"></a><h3>GMappedFile</h3>
<pre class="programlisting">typedef struct _GMappedFile GMappedFile;</pre>
<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
<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
not be accessed directly.
</p>
</div>
<hr>
<div class="refsect2" title="g_mapped_file_new ()">
<a name="g-mapped-file-new"></a><h3>g_mapped_file_new ()</h3>
<pre class="programlisting"><a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile">GMappedFile</a> *       g_mapped_file_new                   (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
                                                         <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean">gboolean</a> writable,
                                                         <a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);</pre>
<p>
Maps a file into memory. On UNIX, this is using the <code class="function">mmap()</code> function.
</p>
<p>
If <em class="parameter"><code>writable</code></em> is <a class="link" href="glib-Standard-Macros.html#TRUE--CAPS" title="TRUE"><code class="literal">TRUE</code></a>, the mapped buffer may be modified, otherwise
it is an error to modify the mapped buffer. Modifications to the buffer 
are not visible to other processes mapping the same file, and are not 
written back to the file.
</p>
<p>
Note that modifications of the underlying file might affect the contents
of the <a 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 
will not be modified, or if all modifications of the file are done
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>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
<td> The path of the file to load, in the GLib filename encoding
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>writable</code></em> :</span></p></td>
<td> whether the mapping should be writable
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td> return location for a <a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="type">GError</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> 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
   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.

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.8</p>
</div>
<hr>
<div class="refsect2" title="g_mapped_file_ref ()">
<a name="g-mapped-file-ref"></a><h3>g_mapped_file_ref ()</h3>
<pre class="programlisting"><a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile">GMappedFile</a> *       g_mapped_file_ref                   (<a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile">GMappedFile</a> *file);</pre>
<p>
Increments the reference count of <em class="parameter"><code>file</code></em> by one.  It is safe to call
this function from any thread.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>file</code></em> :</span></p></td>
<td> a <a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="type">GMappedFile</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> the passed in <a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="type">GMappedFile</span></a>.

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.22</p>
</div>
<hr>
<div class="refsect2" title="g_mapped_file_unref ()">
<a name="g-mapped-file-unref"></a><h3>g_mapped_file_unref ()</h3>
<pre class="programlisting">void                g_mapped_file_unref                 (<a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile">GMappedFile</a> *file);</pre>
<p>
Decrements the reference count of <em class="parameter"><code>file</code></em> by one.  If the reference count
drops to 0, unmaps the buffer of <em class="parameter"><code>file</code></em> and frees it.
</p>
<p>
It is safe to call this function from any thread.
</p>
<p>
Since 2.22</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>file</code></em> :</span></p></td>
<td> a <a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="type">GMappedFile</span></a>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="g_mapped_file_free ()">
<a name="g-mapped-file-free"></a><h3>g_mapped_file_free ()</h3>
<pre class="programlisting">void                g_mapped_file_free                  (<a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile">GMappedFile</a> *file);</pre>
<div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<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. 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>
</div>
<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
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>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>file</code></em> :</span></p></td>
<td> a <a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="type">GMappedFile</span></a>
</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.8</p>
</div>
<hr>
<div class="refsect2" title="g_mapped_file_get_length ()">
<a name="g-mapped-file-get-length"></a><h3>g_mapped_file_get_length ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gsize" title="gsize">gsize</a>               g_mapped_file_get_length            (<a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile">GMappedFile</a> *file);</pre>
<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>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>file</code></em> :</span></p></td>
<td> a <a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="type">GMappedFile</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> the length of the contents of <em class="parameter"><code>file</code></em>.

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.8</p>
</div>
<hr>
<div class="refsect2" title="g_mapped_file_get_contents ()">
<a name="g-mapped-file-get-contents"></a><h3>g_mapped_file_get_contents ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *             g_mapped_file_get_contents          (<a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile">GMappedFile</a> *file);</pre>
<p>
Returns the contents of a <a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="type">GMappedFile</span></a>. 
</p>
<p>
Note that the contents may not be zero-terminated,
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>
<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>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>file</code></em> :</span></p></td>
<td> a <a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="type">GMappedFile</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> the contents of <em class="parameter"><code>file</code></em>, or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>.

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.8</p>
</div>
<hr>
<div class="refsect2" title="g_open ()">
<a name="g-open"></a><h3>g_open ()</h3>
<pre class="programlisting">int                 g_open                              (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
                                                         int flags,
                                                         int mode);</pre>
<p>
A wrapper for the POSIX <code class="function">open()</code> function. The <code class="function">open()</code> function is
used to convert a pathname into a file descriptor.
</p>
<p>
On POSIX systems file descriptors are implemented by the operating
system. On Windows, it's the C library that implements <code class="function">open()</code> and
file descriptors. The actual Win32 API for opening files is quite
different, see MSDN documentation for <code class="function">CreateFile()</code>. The Win32 API
uses file handles, which are more randomish integers, not small
integers like file descriptors.
</p>
<p>
Because file descriptors are specific to the C library on Windows,
the file descriptor returned by this function makes sense only to
functions in the same C library. Thus if the GLib-using code uses a
different C library than GLib does, the file descriptor returned by
this function cannot be passed to C library functions like <code class="function">write()</code>
or <code class="function">read()</code>.
</p>
<p>
See your C library manual for more details about <code class="function">open()</code>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
<td> as in <code class="function">open()</code>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>mode</code></em> :</span></p></td>
<td> as in <code class="function">open()</code>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> a new file descriptor, or -1 if an error occurred. The
return value can be used exactly like the return value from <code class="function">open()</code>.

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.6</p>
</div>
<hr>
<div class="refsect2" title="g_rename ()">
<a name="g-rename"></a><h3>g_rename ()</h3>
<pre class="programlisting">int                 g_rename                            (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *oldfilename,
                                                         const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *newfilename);</pre>
<p>
A wrapper for the POSIX <code class="function">rename()</code> function. The <code class="function">rename()</code> function 
renames a file, moving it between directories if required.
</p>
<p>
See your C library manual for more details about how <code class="function">rename()</code> works
on your system. It is not possible in general on Windows to rename
a file that is open to some process.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>oldfilename</code></em> :</span></p></td>
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>newfilename</code></em> :</span></p></td>
<td> a pathname in the GLib file name encoding
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> 0 if the renaming succeeded, -1 if an error occurred

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.6</p>
</div>
<hr>
<div class="refsect2" title="g_mkdir ()">
<a name="g-mkdir"></a><h3>g_mkdir ()</h3>
<pre class="programlisting">int                 g_mkdir                             (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
                                                         int mode);</pre>
<p>
A wrapper for the POSIX <code class="function">mkdir()</code> function. The <code class="function">mkdir()</code> function 
attempts to create a directory with the given name and permissions.
The mode argument is ignored on Windows.
</p>
<p>
See your C library manual for more details about <code class="function">mkdir()</code>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>mode</code></em> :</span></p></td>
<td> permissions to use for the newly created directory
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> 0 if the directory was successfully created, -1 if an error 
   occurred

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.6</p>
</div>
<hr>
<div class="refsect2" title="g_stat ()">
<a name="g-stat"></a><h3>g_stat ()</h3>
<pre class="programlisting">int                 g_stat                              (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
                                                         struct _g_stat_struct *buf);</pre>
<p>
A wrapper for the POSIX <code class="function">stat()</code> function. The <code class="function">stat()</code> function
returns information about a file. On Windows the <code class="function">stat()</code> function in
the C library checks only the FAT-style READONLY attribute and does
not look at the ACL at all. Thus on Windows the protection bits in
the st_mode field are a fabrication of little use.
</p>
<p>
See your C library manual for more details about <code class="function">stat()</code>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>buf</code></em> :</span></p></td>
<td> a pointer to a <span class="structname">stat</span> struct, which
   will be filled with the file information
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> 0 if the information was successfully retrieved, -1 if an error 
   occurred

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.6</p>
</div>
<hr>
<div class="refsect2" title="g_lstat ()">
<a name="g-lstat"></a><h3>g_lstat ()</h3>
<pre class="programlisting">int                 g_lstat                             (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
                                                         struct _g_stat_struct *buf);</pre>
<p>
A wrapper for the POSIX <code class="function">lstat()</code> function. The <code class="function">lstat()</code> function is
like <code class="function">stat()</code> except that in the case of symbolic links, it returns
information about the symbolic link itself and not the file that it
refers to. If the system does not support symbolic links <a class="link" href="glib-File-Utilities.html#g-lstat" title="g_lstat ()"><code class="function">g_lstat()</code></a>
is identical to <a class="link" href="glib-File-Utilities.html#g-stat" title="g_stat ()"><code class="function">g_stat()</code></a>.
</p>
<p>
See your C library manual for more details about <code class="function">lstat()</code>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>buf</code></em> :</span></p></td>
<td> a pointer to a <span class="structname">stat</span> struct, which
   will be filled with the file information
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> 0 if the information was successfully retrieved, -1 if an error 
   occurred

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.6</p>
</div>
<hr>
<div class="refsect2" title="g_unlink ()">
<a name="g-unlink"></a><h3>g_unlink ()</h3>
<pre class="programlisting">int                 g_unlink                            (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename);</pre>
<p>
A wrapper for the POSIX <code class="function">unlink()</code> function. The <code class="function">unlink()</code> function 
deletes a name from the filesystem. If this was the last link to the 
file and no processes have it opened, the diskspace occupied by the
file is freed.
</p>
<p>
See your C library manual for more details about <code class="function">unlink()</code>. Note
that on Windows, it is in general not possible to delete files that
are open to some process, or mapped into memory.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> 0 if the name was successfully deleted, -1 if an error 
   occurred

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.6</p>
</div>
<hr>
<div class="refsect2" title="g_remove ()">
<a name="g-remove"></a><h3>g_remove ()</h3>
<pre class="programlisting">int                 g_remove                            (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename);</pre>
<p>
A wrapper for the POSIX <code class="function">remove()</code> function. The <code class="function">remove()</code> function
deletes a name from the filesystem.
</p>
<p>
See your C library manual for more details about how <code class="function">remove()</code> works
on your system. On Unix, <code class="function">remove()</code> removes also directories, as it
calls <code class="function">unlink()</code> for files and <code class="function">rmdir()</code> for directories. On Windows,
although <code class="function">remove()</code> in the C library only works for files, this
function tries first <code class="function">remove()</code> and then if that fails <code class="function">rmdir()</code>, and
thus works for both files and directories. Note however, that on
Windows, it is in general not possible to remove a file that is
open to some process, or mapped into memory.
</p>
<p>
If this function fails on Windows you can't infer too much from the
errno value. <code class="function">rmdir()</code> is tried regardless of what caused <code class="function">remove()</code> to
fail. Any errno value set by <code class="function">remove()</code> will be overwritten by that
set by <code class="function">rmdir()</code>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> 0 if the file was successfully removed, -1 if an error 
   occurred

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.6</p>
</div>
<hr>
<div class="refsect2" title="g_rmdir ()">
<a name="g-rmdir"></a><h3>g_rmdir ()</h3>
<pre class="programlisting">int                 g_rmdir                             (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename);</pre>
<p>
A wrapper for the POSIX <code class="function">rmdir()</code> function. The <code class="function">rmdir()</code> function
deletes a directory from the filesystem.
</p>
<p>
See your C library manual for more details about how <code class="function">rmdir()</code> works
on your system.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> 0 if the directory was successfully removed, -1 if an error 
   occurred

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.6</p>
</div>
<hr>
<div class="refsect2" title="g_fopen ()">
<a name="g-fopen"></a><h3>g_fopen ()</h3>
<pre class="programlisting">FILE *              g_fopen                             (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
                                                         const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *mode);</pre>
<p>
A wrapper for the stdio <code class="function">fopen()</code> function. The <code class="function">fopen()</code> function
opens a file and associates a new stream with it.
</p>
<p>
Because file descriptors are specific to the C library on Windows,
and a file descriptor is partof the <span class="type">FILE</span> struct, the
<span class="type">FILE</span> pointer returned by this function makes sense
only to functions in the same C library. Thus if the GLib-using
code uses a different C library than GLib does, the
<span class="type">FILE</span> pointer returned by this function cannot be
passed to C library functions like <code class="function">fprintf()</code> or <code class="function">fread()</code>.
</p>
<p>
See your C library manual for more details about <code class="function">fopen()</code>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>mode</code></em> :</span></p></td>
<td> a string describing the mode in which the file should be 
  opened
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> A <span class="type">FILE</span> pointer 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 an error occurred

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.6</p>
</div>
<hr>
<div class="refsect2" title="g_freopen ()">
<a name="g-freopen"></a><h3>g_freopen ()</h3>
<pre class="programlisting">FILE *              g_freopen                           (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
                                                         const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *mode,
                                                         FILE *stream);</pre>
<p>
A wrapper for the POSIX <code class="function">freopen()</code> function. The <code class="function">freopen()</code> function
opens a file and associates it with an existing stream.
</p>
<p>
See your C library manual for more details about <code class="function">freopen()</code>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>mode</code></em> :</span></p></td>
<td> a string describing the mode in which the file should be 
  opened
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
<td> an existing stream which will be reused, or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> A <span class="type">FILE</span> pointer 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 an error occurred.

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.6</p>
</div>
<hr>
<div class="refsect2" title="g_chmod ()">
<a name="g-chmod"></a><h3>g_chmod ()</h3>
<pre class="programlisting">int                 g_chmod                             (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
                                                         int mode);</pre>
<p>
A wrapper for the POSIX <code class="function">chmod()</code> function. The <code class="function">chmod()</code> function is
used to set the permissions of a file system object.
</p>
<p>
On Windows the file protection mechanism is not at all POSIX-like,
and the underlying <code class="function">chmod()</code> function in the C library just sets or
clears the FAT-style READONLY attribute. It does not touch any
ACL. Software that needs to manage file permissions on Windows
exactly should use the Win32 API.
</p>
<p>
See your C library manual for more details about <code class="function">chmod()</code>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>mode</code></em> :</span></p></td>
<td> as in <code class="function">chmod()</code>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> zero if the operation succeeded, -1 on error.

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.8</p>
</div>
<hr>
<div class="refsect2" title="g_access ()">
<a name="g-access"></a><h3>g_access ()</h3>
<pre class="programlisting">int                 g_access                            (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
                                                         int mode);</pre>
<p>
A wrapper for the POSIX <code class="function">access()</code> function. This function is used to
test a pathname for one or several of read, write or execute
permissions, or just existence.
</p>
<p>
On Windows, the file protection mechanism is not at all POSIX-like,
and the underlying function in the C library only checks the
FAT-style READONLY attribute, and does not look at the ACL of a
file at all. This function is this in practise almost useless on
Windows. Software that needs to handle file permissions on Windows
more exactly should use the Win32 API.
</p>
<p>
See your C library manual for more details about <code class="function">access()</code>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>mode</code></em> :</span></p></td>
<td> as in <code class="function">access()</code>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> zero if the pathname refers to an existing file system
object that has all the tested permissions, or -1 otherwise or on
error.

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.8</p>
</div>
<hr>
<div class="refsect2" title="g_creat ()">
<a name="g-creat"></a><h3>g_creat ()</h3>
<pre class="programlisting">int                 g_creat                             (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
                                                         int mode);</pre>
<p>
A wrapper for the POSIX <code class="function">creat()</code> function. The <code class="function">creat()</code> function is
used to convert a pathname into a file descriptor, creating a file
if necessary.
</p>
<p>
On POSIX systems file descriptors are implemented by the operating
system. On Windows, it's the C library that implements <code class="function">creat()</code> and
file descriptors. The actual Windows API for opening files is
different, see MSDN documentation for <code class="function">CreateFile()</code>. The Win32 API
uses file handles, which are more randomish integers, not small
integers like file descriptors.
</p>
<p>
Because file descriptors are specific to the C library on Windows,
the file descriptor returned by this function makes sense only to
functions in the same C library. Thus if the GLib-using code uses a
different C library than GLib does, the file descriptor returned by
this function cannot be passed to C library functions like <code class="function">write()</code>
or <code class="function">read()</code>.
</p>
<p>
See your C library manual for more details about <code class="function">creat()</code>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>mode</code></em> :</span></p></td>
<td> as in <code class="function">creat()</code>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> a new file descriptor, or -1 if an error occurred. The
return value can be used exactly like the return value from <code class="function">creat()</code>.

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.8</p>
</div>
<hr>
<div class="refsect2" title="g_chdir ()">
<a name="g-chdir"></a><h3>g_chdir ()</h3>
<pre class="programlisting">int                 g_chdir                             (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *path);</pre>
<p>
A wrapper for the POSIX <code class="function">chdir()</code> function. The function changes the
current directory of the process to <em class="parameter"><code>path</code></em>.
</p>
<p>
See your C library manual for more details about <code class="function">chdir()</code>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>path</code></em> :</span></p></td>
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> 0 on success, -1 if an error occurred.

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.8</p>
</div>
<hr>
<div class="refsect2" title="g_utime ()">
<a name="g-utime"></a><h3>g_utime ()</h3>
<pre class="programlisting">int                 g_utime                             (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *filename,
                                                         struct utimbuf *utb);</pre>
<p>
A wrapper for the POSIX <code class="function">utime()</code> function. The <code class="function">utime()</code> function
sets the access and modification timestamps of a file.
</p>
<p>
See your C library manual for more details about how <code class="function">utime()</code> works
on your system.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
<td> a pathname in the GLib file name encoding (UTF-8 on Windows)
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>utb</code></em> :</span></p></td>
<td> a pointer to a struct utimbuf.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> 0 if the operation was successful, -1 if an error 
   occurred

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.18</p>
</div>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.11</div>
</body>
</html>