csid() — Character set ID for multibyte character

Standards

Standards / Extensions C or C++ Dependencies
Language Environment both  

Format

#include <stdlib.h>

int csid(const char *c)

External entry point: @@CSID, __csid;

General description

Determines the character set identifier for the specified multibyte character pointed to by c, that begins in the initial shift state.

To avoid infringing on the user's name space, this nonstandard function has two names. One name is prefixed with two underscore characters, and one name is not. The name without the prefix underscore characters is exposed only when you use LANGLVL(EXTENDED).

To use this function, you must either invoke the function using its external entry point name (that is, the name that begins with two underscore characters), or compile with LANGLVL(EXTENDED). When you use LANGLVL(EXTENDED) any relevant information in the header is also exposed.

Returned value

If successful, csid() returns the character-set identifier for the multibyte character.

If the character is not valid, csid() returns -1.

Note: The multibyte character passed must begin in the initial shift state.

Example

CELEBC29
⁄* CELEBC29                                      

   This example checks character set ID for a character.                        

 *⁄                                                                             
#include "locale.h"                                                             
#include "stdio.h"                                                              
#include "stdlib.h"                                                             
                                                                                
main() {                                                                        
   char *string = "A";                                                          
   int   rc;                                                                    
                                                                                
   rc = csid(string);                                                           
   printf("character '%s' is in character set id %i\n", string, rc);            
}                                                                               
Output
character 'A' is in character set id 0

Related information