gmappedfile.h File Reference

__G_MAPPED_FILE_H__

Typedef GMappedFile

typedef typedefG_BEGIN_DECLS struct _GMappedFileGMappedFile

g_mapped_file_new ( const gchar *, gboolean, GError ** )

IMPORT_C GMappedFile *g_mapped_file_new(const gchar *filename,
gbooleanwritable,
GError **error
)

g_mapped_file_new: : The path of the file to load, in the GLib filename encoding : whether the mapping should be writable : return location for a GError, or NULL

Maps a file into memory. On UNIX, this is using the mmap() function.

If is TRUE, 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.

Note that modifications of the underlying file might affect the contents of the GMappedFile. 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 g_file_set_contents()).

Return value: a newly allocated GMappedFile which must be freed with g_mapped_file_free(), or NULL if the mapping failed.

Since: 2.8

g_mapped_file_get_length ( GMappedFile * )

IMPORT_C gsizeg_mapped_file_get_length(GMappedFile *file)

g_mapped_file_get_contents ( GMappedFile * )

IMPORT_C gchar *g_mapped_file_get_contents(GMappedFile *file)

g_mapped_file_free ( GMappedFile * )

IMPORT_C voidg_mapped_file_free(GMappedFile *file)