## GMimeStreamFile GMimeStreamFile — A Standard-C FILE-based stream |

## Synopsis

    struct              GMimeStreamFile;
    GMimeStream *       g_mime_stream_file_new              (FILE *fp);
    GMimeStream *       g_mime_stream_file_new_with_bounds  (FILE *fp,
                                                             gint64 start,
                                                             gint64 end);
    GMimeStream *       g_mime_stream_file_new_for_path     (const char *path,
                                                             const char *mode);
    gboolean            g_mime_stream_file_get_owner        (GMimeStreamFile *stream);
    void                g_mime_stream_file_set_owner        (GMimeStreamFile *stream,
                                                             gboolean owner);

## Object Hierarchy

      GObject
       +----GMimeStream
             +----GMimeStreamFile

## Description

A simple GMimeStream implementation that sits on top of the Standard C FILE pointer based I/O layer. Unlike GMimeStreamFs, a GMimeStreamFile will typically buffer read and write operations at the FILE level and so it may be wasteful to wrap one in a GMimeStreamBuffer stream.

## Details

### struct GMimeStreamFile

    struct GMimeStreamFile;

A GMimeStream wrapper around standard-c FILE pointers.

### g_mime_stream_file_new ()

    GMimeStream *       g_mime_stream_file_new              (FILE *fp);

Creates a new GMimeStreamFile object around `fp`.

Note: The created GMimeStreamFile object will own the FILE pointer passed in.

`fp` : | a FILE pointer
Returns : | a stream using `fp`.

### g_mime_stream_file_new_with_bounds ()

    GMimeStream *       g_mime_stream_file_new_with_bounds  (FILE *fp,
                                                             gint64 start,
                                                             gint64 end);

Creates a new GMimeStreamFile object around `fp` with bounds `start` and `end`.

Note: The created GMimeStreamFile object will own the FILE pointer passed in.

`fp` : | a FILE pointer
`start` : | start boundary
`end` : | end boundary
Returns : | a stream using `fp` with bounds `start` and `end`.

### g_mime_stream_file_new_for_path ()

    GMimeStream *       g_mime_stream_file_new_for_path     (const char *path,
                                                             const char *mode);

Creates a new GMimeStreamFile object for the specified `path`.

`path` : | the path to a file
`mode` : | as in fopen(3)
Returns : | a stream using for reading and/or writing to the specified file path or `NULL` on error.

Since 2.6.18

### g_mime_stream_file_get_owner ()

    gboolean            g_mime_stream_file_get_owner        (GMimeStreamFile *stream);

Gets whether or not `stream` owns the backend FILE pointer.

`stream` : | a GMimeStreamFile
Returns : | `TRUE` if `stream` owns the backend FILE pointer or `FALSE` otherwise.

### g_mime_stream_file_set_owner ()

    void                g_mime_stream_file_set_owner        (GMimeStreamFile *stream,
                                                             gboolean owner);

Sets whether or not `stream` owns the backend FILE pointer.

Note: `owner` should be `TRUE` if the stream should `fclose()` the backend FILE pointer when destroyed or `FALSE` otherwise.

`stream` : | a GMimeStreamFile
`owner` : | `TRUE` if this stream should own the FILE pointer or `FALSE` otherwise

## See Also

GMimeStream