duplocale Subroutine

Purpose

Duplicates a locale object.

Library

Standard C Library (libc.a)

Syntax

#include <locale.h>
locale_t duplocale(locobj);
locale_t locobj;

Description

The duplocale subroutine creates a duplicate copy of the locale object that is referenced by the locobj argument.

If the locobj argument value is LC_GLOBAL_LOCALE, the duplocale subroutine creates a new locale object that contains a copy of the global locale that is determined by the setlocale subroutine.

If the locobj argument is not a valid handle for a locale object, the behavior of the duplocale subroutine is undefined.

Return Values

If successful, the duplocale subroutine returns a handle for a new locale object. Otherwise, the duplocale subroutine returns ( locale_t) 0 and sets the errno global variable to indicate the error.

Error Codes

The duplocale subroutine fails if the following is true:

Item Description
ENOMEM

There is not enough memory available to create the locale object or load the locale data.

The duplocale subroutine might fail if the following is true:

Item Description
EINVAL The locobj argument is not a handle for a locale object.