Syntax
#include <nl_types.h> nl_catd catopen(const char *name, int oflag);Description
If the catalog file name referred to by the CatalogName parameter contains a drive letter or a \, it is assumed to be an absolute pathname. That is, the catalog looked for following that path. If the catalog file name is not an absolute path name, the user environment determines which directory paths to search. The NLSPATH environment variable defines the directory search path.
Single-letter keywords for the NLSPATH are used as special variables as follows:
The value of the LC_MESSAGES category can be set by specifying values for the LANG, LC_ALL, or LC_MESSAGES environment variable. The value of the LC_MESSAGES category indicates which locale specific directory to search for message catalogs. For example, if the catopen subroutine specifies a catalog with the name mycmd, and the environment variables are set as follows:
NLSPATH=..\%N;\%N;\system\nls\%L\%N;\system\nls\%NLANG=Fr_FR.IBM-850
then the application searches for the catalog in the following order:
If you omit the %N variable in a directory specification within the NLSPATH environment variable, the application assumes that the path defines a directory and searches for the catalog in that directory before searching the next specified path.
If the NLSPATH environment variable is not defined, the default path of . (current directory) is used.
The parameters are:
name
The catopen subroutine returns a catalog descriptor.
If the catopen subroutine returns a value of CATD_ERR ( (nl_catd) -1), an error has occurred during creation of the nl_catd structure.
#include <stdio.h>#include <nl_types.h> void load_cat(char *tcat) { nl_catd catd; /* Catalog descriptor. */ if ((catd = catopen(tcat, 0)) == CATD_ERR) { printf("Unable to load specified catalog. \n"); exit(1); } if (catclose(catd) == -1) printf("Error when trying to close catalog file\n"); }Related Information