Reading and Writing from local files and directories: GSF Reference Manual

## Reading and Writing from local files and directories Reading and Writing from local files and directories |

## Functions

GsfInput * | gsf_input_stdio_new ()
GsfInput * | gsf_input_stdio_new_FILE ()
GsfOutput * | gsf_output_stdio_new ()
GsfOutput * | gsf_output_stdio_new_full ()
GsfOutput * | gsf_output_stdio_new_valist ()
GsfOutput * | gsf_output_stdio_new_FILE ()
GsfOutfile * | gsf_outfile_stdio_new ()
GsfOutfile * | gsf_outfile_stdio_new_full ()
GsfOutfile * | gsf_outfile_stdio_new_valist ()
GsfInfile * | gsf_infile_stdio_new ()

## Types and Values

| GsfInputStdio
| GsfOutputStdio
| GsfOutfileStdio
| GsfInfileStdio

## Object Hierarchy

        GObject
        ├── GsfInput
        │   ├── GsfInfile
        │   │   ╰── GsfInfileStdio
        │   ╰── GsfInputStdio
        ╰── GsfOutput
            ├── GsfOutfile
            │   ╰── GsfOutfileStdio
            ╰── GsfOutputStdio

## Description

## Functions

### gsf_input_stdio_new ()

    GsfInput *
    gsf_input_stdio_new (char const *filename,
                         GError **err);

#### Parameters

filename | in utf8. |
err | place to store a GError if anything goes wrong. | [out][optional][nullable]

#### Returns

a new file or `NULL`.

### gsf_input_stdio_new_FILE ()

    GsfInput *
    gsf_input_stdio_new_FILE (char const *filename,
                              FILE *file,
                              gboolean keep_open);

Assumes ownership of `file` when succeeding. If `keep_open` is true, ownership reverts to caller when the GsfInput is closed.

#### Parameters

filename | The filename corresponding to `file` . |
file | an existing stdio FILE *. | [transfer full]
keep_open | Should `file` be closed when the wrapper is closed |

#### Returns

a new GsfInput wrapper for `file` . Note that if the file is not seekable, this function will make a local copy of the entire file.

### gsf_output_stdio_new ()

    GsfOutput *
    gsf_output_stdio_new (char const *filename,
                          GError **err);

#### Parameters

filename | name of file to create or replace. |
err | place to store a GError if anything goes wrong. | [out][optional][nullable]

#### Returns

a new file or `NULL`.

### gsf_output_stdio_new_full ()

    GsfOutput *
    gsf_output_stdio_new_full (char const *filename,
                               GError **err,
                               char const *first_property_name,
                               ...);

#### Parameters

filename | name of file to create or replace. |
err | place to store a GError if anything goes wrong. | [out][optional][nullable]
first_property_name | `NULL` terminated list of properties |

#### Returns

a new file or `NULL`.

### gsf_output_stdio_new_valist ()

    GsfOutput *
    gsf_output_stdio_new_valist (char const *filename,
                                 GError **err,
                                 char const *first_property_name,
                                 va_list var_args);

### gsf_output_stdio_new_FILE ()

    GsfOutput *
    gsf_output_stdio_new_FILE (char const *filename,
                               FILE *file,
                               gboolean keep_open);

Assumes ownership of `file` . If `keep_open` is true, ownership reverts to caller when the GsfOutput is closed.

[skip]

#### Parameters

filename | The filename corresponding to `file` . |
file | an existing stdio FILE *. | [transfer full]
keep_open | Should `file` be closed when the wrapper is closed |

#### Returns

a new GsfOutput wrapper for `file` . Warning: the result will be seekable only if `file` is seekable. If it is seekable, the resulting GsfOutput object will seek relative to `file` 's beginning, not its current location at the time the GsfOutput object is created.

### gsf_outfile_stdio_new ()

    GsfOutfile *
    gsf_outfile_stdio_new (char const *root,
                           GError **err);

#### Parameters

root | root directory in utf8. |
err | place to store a GError if anything goes wrong. | [out][optional][nullable]

#### Returns

a new outfile or `NULL`.

### gsf_outfile_stdio_new_full ()

    GsfOutfile *
    gsf_outfile_stdio_new_full (char const *root,
                                GError **err,
                                char const *first_property_name,
                                ...);

#### Parameters

root | root directory in utf8. |
err | place to store a GError if anything goes wrong. | [out][optional][nullable]
first_property_name | name of first property to set |
... | value of first property, followed by more properties, `NULL`-terminated |

#### Returns

a new outfile or `NULL`.

[transfer full]

### gsf_outfile_stdio_new_valist ()

    GsfOutfile *
    gsf_outfile_stdio_new_valist (char const *root,
                                  GError **err,
                                  char const *first_property_name,
                                  va_list var_args);

#### Parameters

root | root directory in utf8. |
err | place to store a GError if anything goes wrong. | [out][optional][nullable]
first_property_name | name of first property to set |
var_args | a `NULL`-terminated va_list |

#### Returns

a new outfile or `NULL`.

[transfer full]

### gsf_infile_stdio_new ()

    GsfInfile *
    gsf_infile_stdio_new (char const *root,
                          GError **err);

#### Parameters

root | in locale dependent encoding |
err | place to store a GError if anything goes wrong. | [out][optional][nullable]

#### Returns

a new file or `NULL`.

## Types and Values

### GsfInputStdio

    typedef struct _GsfInputStdio GsfInputStdio;

### GsfOutputStdio

    typedef struct _GsfOutputStdio GsfOutputStdio;

### GsfOutfileStdio

    typedef struct _GsfOutfileStdio GsfOutfileStdio;

### GsfInfileStdio

    typedef struct _GsfInfileStdio GsfInfileStdio;