Gnome Library Reference Manual
<<< Previous Page | Home | Up | Next Page >>>

# gnome-fileconvert

## Name

gnome-fileconvert -- File format conversion functions.

## Synopsis

    #include <gnome.h>

    gint        gnome_file_convert_fd           (gint fd,
                                                 gchar *fromtype,
                                                 gchar *totype);
    gint        gnome_file_convert              (const char *filename,
                                                 const char *fromtype,
                                                 const char *totype);

## Description

These routines provide conversion of information based on a source and target mime type. They return -1 on failure, or an opened file descriptor with the data on success

The rules for converting from one MIME type to another are loaded from the `$gnome-prefix/share/type-convert` directory. Any files in that directory whose extension is `.convert` is loaded as well as the per-user `~/.gnome/type.convert` file.

The file format used to define a filter is very simple:

Example 1. Sample MIME type file conversion definition

    image/gif image/x-portable-pixmap giftopnm

This sample file conversion file defines a conversion rule from the image/gif MIME type to the image/x-portable-pixmap MIME type. The program used for the conversion is `giftopnm`. This program should do the specified MIME type conversion by reading its standard input and writing the results on the standard output.

## Details

### gnome_file_convert_fd ()

    gint        gnome_file_convert_fd           (gint fd,
                                                 gchar *fromtype,
                                                 gchar *totype);

Converts the file opened by `fd` to the `totype` format.

`fd` : | file desciptor pointing to the file to convert.
`fromtype` : | mime type of the file
`totype` : | target mime type we want
Returns : | -1 on failure, or a file descriptor to the converted file.

### gnome_file_convert ()

    gint        gnome_file_convert              (const char *filename,
                                                 const char *fromtype,
                                                 const char *totype);

Converts `filename` to the `totype` format.

`filename` : | file to convert
`fromtype` : | mime type of the file
`totype` : | target mime type we want
Returns : | -1 on failure, or a file descriptor to the converted file.

<<< Previous Page | Home | Up | Next Page >>>
gnome-exec | gnome-help