Name

iconv_close - deallocates descriptor for character set conversion

Library

libc.lib

Synopsis

  #include <iconv.h>
  int iconv_close (iconv_t cd);

Return values

On deallocating the conversion descriptor, the iconv_close function returns 0. In case of error, it sets the respective errno and returns -1.

Detailed description

The iconv_close function deallocates a conversion descriptor cd allocated using iconv_open.

The iconv_close sets errno to EBADF if the conversion descriptor is a bad descriptor


Examples

#include<stdio.h>
#include<iconv.h>
int main()
{
        iconv_t cd = NULL;
        //Allocate descriptor for charset conversion
        cd = iconv_open("UTF-8", "ISO-8859-1");
        if(cd == (iconv_t) -1)
        {
                printf("Unbale to create a conversion descriptor0);
        }
        else
        {
                printf("Conversion descriptor is created successfully0);
        }
        if(!iconv_close(cd))
        {
         printf("Conversion descriptor is deallocated successfully0);
        }
        else
        {
         printf("Conversion descriptor deallocation failed0);
        }
        return 0;
}

         

Output

Conversion descriptor is created successfully
Conversion descriptor is deallocated successfully

         

Errors

EBADF Bad file descriptor

See also

iconv, iconv_open

Feedback

For additional information or queries on this page send feedback

© 2005-2007 Nokia

Top