<refentry id="gnome-gnome-fileconvert">
<refmeta>
<refentrytitle>gnome-fileconvert</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GNOME Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>gnome-fileconvert</refname><refpurpose>File format conversion functions.</refpurpose>
</refnamediv>

<refsynopsisdiv><title>Synopsis</title>
<synopsis>

#include &lt;gnome.h&gt;


<link linkend="gint">gint</link>        <link linkend="gnome-file-convert-fd">gnome_file_convert_fd</link>           (<link linkend="gint">gint</link> fd,
                                             <link linkend="gchar">gchar</link> *fromtype,
                                             <link linkend="gchar">gchar</link> *totype);
<link linkend="gint">gint</link>        <link linkend="gnome-file-convert">gnome_file_convert</link>              (const char *filename,
                                             const char *fromtype,
                                             const char *totype);
</synopsis>
</refsynopsisdiv>





<refsect1>
<title>Description</title>
<para>
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</para>

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

    <para>The file format used to define a filter is very
    simple:</para>

      <example>
	<title>Sample MIME type file conversion definition</title>
	<programlisting>
image/gif image/x-portable-pixmap giftopnm
	</programlisting>
     </example>
    <para>
	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
	<filename>giftopnm</filename>.  This program should do the
	specified MIME type conversion by reading its standard input
	and writing the results on the standard output.
    </para>
</refsect1>

<refsect1>
<title>Details</title>
<refsect2>
<title><anchor id="gnome-file-convert-fd">gnome_file_convert_fd ()</title>
<programlisting><link linkend="gint">gint</link>        gnome_file_convert_fd           (<link linkend="gint">gint</link> fd,
                                             <link linkend="gchar">gchar</link> *fromtype,
                                             <link linkend="gchar">gchar</link> *totype);</programlisting>
<para>
Converts the file opened by <parameter>fd</parameter> to the <parameter>totype</parameter> format.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>fd</parameter>&nbsp;:</entry>
<entry> file desciptor pointing to the file to convert.
</entry></row>
<row><entry align="right"><parameter>fromtype</parameter>&nbsp;:</entry>
<entry> mime type of the file
</entry></row>
<row><entry align="right"><parameter>totype</parameter>&nbsp;:</entry>
<entry>   target mime type we want
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>-1 on failure, or a file descriptor to the converted
file.
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gnome-file-convert">gnome_file_convert ()</title>
<programlisting><link linkend="gint">gint</link>        gnome_file_convert              (const char *filename,
                                             const char *fromtype,
                                             const char *totype);</programlisting>
<para>
Converts <parameter>filename</parameter> to the <parameter>totype</parameter> format.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>filename</parameter>&nbsp;:</entry>
<entry> file to convert
</entry></row>
<row><entry align="right"><parameter>fromtype</parameter>&nbsp;:</entry>
<entry> mime type of the file
</entry></row>
<row><entry align="right"><parameter>totype</parameter>&nbsp;:</entry>
<entry>   target mime type we want
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>-1 on failure, or a file descriptor to the converted
file.
</entry></row>
</tbody></tgroup></informaltable></refsect2>

</refsect1>




</refentry>
