DEC C
Run-Time Library Reference Manual for OpenVMS Systems


Previous Contents Index

See also wctype in this section.


Return Values

nonzero If the character has the property wc_prop.
0 If the character does not have the property wc_prop.

Example


#include <locale.h> 
#include <wchar.h> 
#include <stdio.h> 
#include <stdlib.h> 
#include <string.h>                                        
#include <ctype.h> 
 
/* This test will set up the "upper" character class using wctype()  */ 
/* and then verify whether the character 'a' and 'A' are             */ 
/* members of this class                                             */ 
 
#include <stdlib.h> 
 
main() 
{ 
 
wchar_t w_char1, w_char2; 
wctype_t ret_val; 
 
char *char1 = "a"; 
char *char2 = "A"; 
                                                                          
    ret_val = wctype("upper");                         
 
    /* Convert char1 to wide-character format - w_char1 */ 
 
    if (mbtowc(&w_char1, char1, 1) == -1) 
        { 
        perror("mbtowc"); 
        exit(EXIT_FAILURE); 
        } 
 
    if (iswctype((wint_t)w_char1, ret_val)) 
        printf("[%C] is a member of the character class upper\n",w_char1); 
    else 
        printf("[%C] is not a member of the character class upper\n",w_char1); 
 
    /* Convert char2 to wide-character format - w_char2 */ 
 
    if (mbtowc(&w_char2, char2, 1) == -1) 
        { 
        perror("mbtowc"); 
        exit(EXIT_FAILURE); 
        } 
 
    if (iswctype((wint_t)w_char2, ret_val)) 
        printf("[%C] is a member of the character class upper\n",w_char2); 
    else 
        printf("[%C] is not a member of the character class upper\n",w_char2); 
 
} 

Running the example program produces the following result:


[a] is not a member of the character class upper 
[A] is a member of the character class upper 


iswdigit

Indicates if a wide character is classed as a digit in the program's current locale.

Format

#include <wctype.h>

(ISO C) #include <wchar.h>

(XPG4) int iswdigit (wint_t wc);


ARGUMENTS

wc

An object of type wint_t . The value of wc must be representable as a wchar_t in the current locale, or must equal the value of the macro WEOF. If it has any other value, the behavior is undefined.

Return Values

nonzero If a decimal digit.
0 If not a decimal digit.

iswgraph

Indicates if a wide character is classed as a graphic character in the program's current locale.

Format

#include <wctype.h>

(ISO C) #include <wchar.h>

(XPG4) int iswgraph (wint_t wc);


ARGUMENTS

wc

An object of type wint_t . The value of wc must be representable as a wchar_t in the current locale, or must equal the value of the macro WEOF. If it has any other value, the behavior is undefined.

Return Values

nonzero If a graphic character.
0 If not a graphic character.

iswlower

Indicates if a wide character is classed as a lowercase character in the program's current locale.

Format

#include <wctype.h>

(ISO C) #include <wchar.h>

(XPG4) int iswlower (wint_t wc);


ARGUMENTS

wc

An object of type wint_t . The value of wc must be representable as a wchar_t in the current locale, or must equal the value of the macro WEOF. If it has any other value, the behavior is undefined.

Return Values

nonzero If a lowercase character.
0 If not a lowercase character.

iswprint

Indicates if a wide character is classed as a printing character in the program's current locale.

Format

#include <wctype.h>

(ISO C) #include <wchar.h>

(XPG4) int iswprint (wint_t wc);


ARGUMENTS

wc

An object of type wint_t . The value of wc must be representable as a wchar_t in the current locale, or must equal the value of the macro WEOF. If it has any other value, the behavior is undefined.

Return Values

nonzero If a printing character.
0 If not a printing character.

iswpunct

Indicates if a wide character is classed as a punctuation character in the program's current locale.

Format

#include <wctype.h>

(ISO C) #include <wchar.h>

(XPG4) int iswpunct (wint_t wc);


ARGUMENTS

wc

An object of type wint_t . The value of wc must be representable as a wchar_t in the current locale, or must equal the value of the macro WEOF. If it has any other value, the behavior is undefined.

Return Values

nonzero If a punctuation character.
0 If not a punctuation character.

iswspace

Indicates if a wide character is classed as a space character in the program's current locale.

Format

#include <wctype.h>

(ISO C) #include <wchar.h>

(XPG4) int iswspace (wint_t wc);


ARGUMENTS

wc

An object of type wint_t . The value of wc must be representable as a wchar_t in the current locale, or must equal the value of the macro WEOF. If it has any other value, the behavior is undefined.

Return Values

nonzero If a whitespace character.
0 If not a whitespace character.

iswupper

Indicates if a wide character is classed as an uppercase character in the program's current locale.

Format

#include <wctype.h>

(ISO C) #include <wchar.h>

(XPG4) int iswupper (wint_t wc);


ARGUMENTS

wc

An object of type wint_t . The value of wc must be representable as a wchar_t in the current locale, or must equal the value of the macro WEOF. If it has any other value, the behavior is undefined.

Return Values

nonzero If an uppercase character.
0 If not an uppercase character.

iswxdigit

Indicates if a wide character is a hexadecimal digit (0 to 9, A to F, or a to f) in the program's current locale.

Format

#include <wctype.h>

(ISO C) #include <wchar.h>

(XPG4) int iswxdigit (wint_t wc);


ARGUMENTS

wc

An object of type wint_t . The value of wc must be representable as a wchar_t in the current locale, or must equal the value of the macro WEOF. If it has any other value, the behavior is undefined.

Return Values

nonzero If a hexadecimal digit.
0 If not a hexadecimal digit.

isxdigit

Indicates if a character is a hexadecimal digit (0 to 9, A to F, or a to f) in the program's current locale.

Format

#include <ctype.h>

int isxdigit (int character);


ARGUMENT

character

An object of type int . The value of character must be representable as an unsigned char in the current locale, or must equal the value of the macro EOF. If it has any other value, the behavior is undefined.

Return Values

nonzero If a hexadecimal digit.
0 If not a hexadecimal digit.

jrand48

Generate uniformly distributed pseudorandom number sequences. Returns 48-bit signed, long integers.

Format

#include <stdlib.h>

long int jrand48 (unsigned short int xsubi[3]);


ARGUMENTS

xsubi

An array of three short int that form a 48-bit integer when concatentated together.

DESCRIPTION

This function generates pseudorandom numbers using the linear congruential algorithm and 48-bit integer arithmetic.

The function returns signed long integers uniformly distributed over the range of y values, such that -2^31 <= y < 2^31 .

The function works by generating a sequence of 48-bit integer values, Xi, according to the linear congruential formula:


       Xn+1 = (aXn+c)mod m        n >= 0 

The argument m equals 2^48 , so 48-bit integer arithmetic is performed. Unless you invoke the lcong48 function, the multiplier value a and the addend value c are:


      a = 5DEECE66D16 = 2736731631558
      c = B16 = 138

The jrand48 function requires that the calling program pass an array as the xsubi argument, which for the first call must be initialized to the initial value of the pseudorandom number sequence. Unlike the drand48 function, it is not necessary to call an initialization function prior to the first call.

By using different arguments, jrand48 allows separate modules of a large program to generate several independent sequences of pseudorandom numbers. For example, the sequence of numbers that one module generates does not depend upon how many times the function is called by other modules.


Return Values

n Signed, long integers uniformly distributed over the range -2^ 31 <= y < 2^ 31 .

kill

Sends a signal to the process specified by a process ID.

Format

#include <signal.h>

int kill (int pid, int sig);


ARGUMENTS

pid

The process ID.

sig

The signal code.

DESCRIPTION

This function sends a signal to a process, as if the process had called raise . If the signal is not trapped or ignored by the target program, the program exits.

OpenVMS VAX and Alpha implement different rules about what process you are allowed to send signals to. A program always has privileges to send a signal to a child started with vfork / exec . For other processes, the results are determined by the OpenVMS security model for your system.

Unless you have system privileges, the sending and receiving processes must have the same user identification code (UIC).

On OpenVMS systems before Version 7.0, kill treats a signal value of 0 as if SIGKILL were specified.

For OpenVMS Version 7.0 and higher systems, if you include <stdlib.h> and compile with the _POSIX_EXIT feature-test macro set, then:


Return Values

0 Indicates that kill was successfully queued.
--1 Indicates errors. The receiving process may have a different UIC and you are not a system user, or the receiving process does not exist.

labs

Returns the absolute value of an integer as a long int .

Format

#include <stdlib.h>

long int labs (long int j);


ARGUMENT

j

A value of type long int .

lcong48

Initializes a 48-bit uniformly distributed pseudorandom number sequences.

Format

#include <stdlib.h>

void lcong48 (unsigned short int param[7]);


ARGUMENTS

param

An array that in turn specifies the initial Xi, the multiplier value a, and the addend value c.

DESCRIPTION

This function generates pseudorandom numbers using the linear congruential algorithm and 48-bit integer arithmetic.

You can use lcong48 to initialize the random number generator before you call any of the following functions:

The lcong48 function specifies the initial Xi value, the multiplier value a, and the addend value c. The param array elements specify the following:
param[0-2] Xi
param[3-5] Multiplier a value
param[6] 16-bit addend c value

After lcong48 has been called, a subsequent call to either srand48 or seed48 restores the standard a and c as specified previously.

The lcong48 function does not return a value.

See also drand48 , lrand48 , mrand48 , srand48 , and seed48 in this section.


ldexp

Returns its first argument multiplied by 2 raised to the power of its second argument; that is, x(2^n) .

Format

#include <math.h>

double ldexp (double x, int n);


ARGUMENTS

x

A base value of type double that is to be multiplied by 2^n .

n

The integer exponent value to which 2 is raised.

Return Values

x(2^ n) The first argument multiplied by 2 raised to the power of the second argument.
0 Indicates underflow; errno is set to ERANGE.
HUGE_VAL Indicates overflow; errno is set to ERANGE.

ldiv

Returns the quotient and the remainder after the division of its arguments.

Format

#include <stdlib.h>

ldiv_t ldiv (long int numer, long int denom);


ARGUMENTS

numer

A numerator of type long int .

denom

A denominator of type long int .

DESCRIPTION

The type ldiv_t is defined in the <stdlib.h> header file as follows:


typedef struct 
        { 
             long   quot, rem; 
        } ldiv_t; 

See also div in this section.


leaveok

Signals Curses to leave the cursor at the current coordinates after an update to the window.

Format

#include <curses.h>

leaveok (WINDOW *win, bool boolf);


ARGUMENTS

win

A pointer to the window.

boolf

A Boolean TRUE or FALSE value. If boolf is TRUE, the cursor remains in place after the last update and the coordinate setting on win changes accordingly. If boolf is FALSE, the cursor moves to the currently specified (y,x) coordinates of win.

DESCRIPTION

This function defaults to moving the cursor to the current coordinates of win. The bool type is defined in the <curses.h> header file as follows:


#define bool int 


localeconv

Sets the members of a structure of type struct lconv with values appropriate for formatting numeric quantities according to the rules of the current locale.

Format

#include <locale.h>

struct lconv *localeconv (void);


DESCRIPTION

This function returns a pointer to the lconv structure defined in the <locale.h> header file. This structure should not be modified by the program. It is overwritten by calls to localeconv , or by calls to the setlocale function that change the LC_NUMERIC, LC_MONETARY, or LC_ALL categories.

The members of the structure are:
Member Description
char *decimal_point The radix character
char *thousands_sep The character used to separate groups of digits
char *grouping The string that defines how digits are grouped in non-monetary values.
char *int_curr_symbol The international currency symbol
char *currency_symbol The local currency symbol
char *mon_decimal_point The radix character used to format monetary values
char *mon_thousands_sep The character used to separate groups of digits in monetary values
char *mon_grouping The string that defines how digits are grouped in a monetary value
char *positive_sign The string used to indicate a non-negative monetary value
char *negative_sign The string used to indicate a negative monetary value
char int_frac_digits The number of digits displayed after the radix character in a monetary value formatted with the international currency symbol.
char frac_digits The number of digits displayed after the radix character in a monetary value
char p_cs_precedes For positive monetary values, this is set to 1 if the local or international currency symbol precedes the number, and it is set to 0 if the symbol succeeds the number.
char p_sep_by_space For positive monetary values, this is set to 0 if there is no space between the currency symbol and the number. It is set to 1 if there is a space, and it is set to 2 if there is a space between the symbol and the sign string.
char n_cs_precedes For negative monetary values, this is set to 1 if the local or international currency symbol precedes the number, and it is set to 0 if the symbol succeeds the number.
char n_sep_by_space For negative monetary values, this is set to 0 if there is no space between the currency symbol and the number. It is set to 1 if there is a space, and it is set to 2 if there is a space between the symbol and the sign string.
char p_sign_posn An integer used to indicate where the positive_sign string should be placed for a non-negative monetary quantity.
char n_sign_posn An integer used to indicate where the negative_sign string should be placed for a negative monetary quantity.

Members of the structure of type char * are pointers to strings, any of which (except decimal_point) can point to "", indicating that the associated value is not available in the current locale or is zero length. Members of the structure of type char are positive numbers, any of which can be CHAR_MAX, indicating that the associated value is not available in the current locale. CHAR_MAX is defined in the <limits.h> header file.

When comparing values against CHAR_MAX, cast CHAR_MAX to type char as follows:


(char) CHAR_MAX 

The members grouping and mon_grouping point to a string that defines the size of each group of digits when formatting a number. Each group size is separated by a semicolon (;). For example, if grouping points to the string 5;3 and the thousands_sep character is a comma (,), the number 123450000 would be formatted as 1,234,50000.


Previous Next Contents Index