United States    
COMPAQ STORE | PRODUCTS |
SERVICES | SUPPORT | CONTACT US | SEARCH
Compaq C

Compaq C
Run-Time Library Reference Manual for OpenVMS Systems


Previous Contents Index


mv[w]delch

Move the cursor to coordinates (y,x) and delete the character on the specified window. The mvdelch function acts on the stdscr window.

Format

#include <curses.h>

int mvdelch (int y, int x);

int mvwdelch (WINDOW *win, int y, int x);


Arguments

win

A pointer to the window.

y

A window coordinate.

x

A window coordinate.

Description

Each of the following characters on the same line shifts to the left, and the last character becomes blank.

Return Values

OK Indicates success.
ERR Indicates that deleting the character would cause the screen to scroll illegally. For more information, see the scrollok function in this section.

mv[w]getch

Move the cursor to coordinates (y,x), get a character from the terminal screen, and echo it on the specified window. The mvgetch function acts on the stdscr window.

Format

#include <curses.h>

int mvgetch (int y, int x);

int mvwgetch (WINDOW *win, int y, int x);


Arguments

win

A pointer to the window.

y

A window coordinate.

x

A window coordinate.

Description

The mvgetch and mvwgetch functions refresh the specified window before fetching the character.

Return Values

x The returned character.
ERR Indicates that the function causes the screen to scroll illegally. For more information, see the scrollok function in this section.

mv[w]getstr

Move the cursor to coordinates (y,x), get a string from the terminal screen, store it in the variable str which must be large enough to contain the string, and echo it on the specified window. The mvgetstr function acts on the stdscr window.

Format

#include <curses.h>

int mvgetstr (int y, int x, char *str);

int mvwgetstr (WINDOW *win, int y, int x, char *str);


Arguments

win

A pointer to the window.

y

A window coordinate.

x

A window coordinate.

str

The string that is displayed.

Description

The mvgetstr and mvwgetstr functions strip the new-line terminator (\n) from the string.

Return Values

OK Indicates success.
ERR Indicates that the function causes the screen to scroll illegally.

mv[w]inch

Move the cursor to coordinates (y,x) and return the character on the specified window without making changes to the window. The mvinch function acts on the stdscr window.

Format

#include <curses.h>

int mvinch (int y, int x);

int mvwinch (WINDOW *win, int y, int x);


Arguments

win

A pointer to the window.

y

A window coordinate.

x

A window coordinate.

Return Values

x The returned character.
ERR Indicates an input error.

mv[w]insch

Move the cursor to coordinates (y,x) and insert the character ch into the specified window. The mvinsch function acts on the stdscr window.

Format

#include <curses.h>

int mvinsch (int y, int x, char ch);

int mvwinsch (WINDOW *win, int y, int x, char ch);


Arguments

win

A pointer to the window.

y

A window coordinate.

x

A window coordinate.

ch

The character to be inserted at the window's coordinates.

Description

After the character is inserted, each character on the line shifts to the right, and the last character on the line is deleted.

Return Values

OK Indicates success.
ERR Indicates that the function makes the screen scroll illegally. For more information, see the scrollok function in this section.

mv[w]insstr

Move the cursor to coordinates (y,x) and insert the specified string into the specified window. The mvinsstr function acts on the stdscr window.

Format

#include <curses.h>

int mvinsstr (int y, int x, char *str);

int mvwinsstr (WINDOW *win, int y, int x, char *str);


Arguments

win

A pointer to the window.

y

A window coordinate.

x

A window coordinate.

str

The string that is displayed.

Description

Each character after the string shifts to the right, and the last character disappears. The mvinsstr and mvwinsstr functions are specific to Compaq C for OpenVMS Systems and are not portable.

Return Values

OK Indicates success.
ERR Indicates that the function makes the screen scroll illegally. For more information, see the scrollok function in this section.

mvwin

Moves the starting position of the window to the specified (y,x) coordinates.

Format

#include <curses.h>

mvwin (WINDOW *win, int y, int x);


Arguments

win

A pointer to the window.

y

A window coordinate.

x

A window coordinate.

Description

When moving subwindows, the mvwin function does not rewrite the contents of the subwindow on the underlying window at the new position. If you write anything to the subwindow after the move, the function also writes to the underlying window.

Return Values

OK Indicates success.
ERR Indicates that moving the window put part or all of the window off the edge of the terminal screen. The terminal screen remains unaltered.

newwin

Creates a new window with numlines lines and numcols columns starting at the coordinates (begin_y,begin_x) on the terminal screen.

Format

#include <curses.h>

WINDOW *newwin (int numlines, int numcols, int begin_y, int begin_x);


Arguments

numlines

If it is 0, the newwin function sets that dimension to LINES (begin_y). To get a new window of dimensions LINES by COLS, use the following line:


newwin (0, 0, 0, 0) 

numcols

If it is 0, the newwin function sets that dimension to COLS (begin_x). Thus, to get a new window of dimensions LINES by COLS, use the following line:


newwin (0, 0, 0, 0) 

begin_y

A window coordinate.

begin_x

A window coordinate.

Return Values

x The address of the allocated window.
ERR Indicates an error.

nice

Increases or decreases process priority relative to the process current priority by the amount of the argument. This function is nonreentrant.

Format

#include <unistd.h>

int nice (int increment);


Argument

increment

As a positive argument, decreases priority; as a negative argument, increases priority. Issuing nice(0) restores the base priority. The resulting priority cannot be less than 1, or greater than the process's base priority. If it is, the nice function quietly does nothing.

Description

When a process calls the vfork function, the resulting child inherits the parent's priority.

See also vfork in this section.


Return Values

0 Indicates success.
--1 Indicates failure.

[no]nl

The nl and nonl functions are provided only for UNIX software compatibility and have no function in the OpenVMS environment.

Format

#include <curses.h>

void nl (void);

void nonl (void);


nl_langinfo

Returns a pointer to a string that contains information obtained from the program's current locale.

Format

#include <langinfo.h>

char *nl_langinfo (nl_item item);


Arguments

item

The name of a constant that specifies the information required. These constants are defined in <langinfo.h> .

The following constants are valid:
Constant Category Description
D_T_FMT LC_TIME String for formatting date and time
D_FMT LC_TIME String for formatting date
T_FMT LC_TIME String for formatting time
T_FMT_AMPM LC_TIME Time format with AM/PM string
AM_STR LC_TIME String that represents AM in 12-hour clock notation
PM_STR LC_TIME String that represents PM in 12-hour clock notation
DAY_1 LC_TIME The name of the first day of the week
...    
DAY_7 LC_TIME The name of the seventh day of the week
ABDAY_1 LC_TIME The abbreviated name of the first day of the week
...    
ABDAY_7 LC_TIME The abbreviated name of the seventh day of the week
MON_1 LC_TIME The name of the first month in the year
...    
MON_12 LC_TIME The name of the twelfth month in the year
ABMON_1 LC_TIME The abbreviated name of the first month in the year
...    
ABMON_12 LC_TIME The abbreviated name of the twelfth month in the year
ERA LC_TIME Era description strings
ERA_D_FMT LC_TIME Era date format string
ERA_T_FMT LC_TIME Era time format
ERA_D_T_FMT LC_TIME Era date and time format
ALT_DIGITS LC_TIME Alternative symbols for digits
RADIXCHAR LC_NUMERIC The radix character
THOUSEP LC_NUMERIC The character used to separate groups of digits in non-monetary values
YESEXP LC_MESSAGES The expression for affirmative responses to yes/no questions
NOEXP LC_MESSAGES The expression for negative responses to yes/no questions
CRNCYSTR LC_MONETARY The currency symbol. It is preceded by one of the following:
  • A minus (-) if the symbol is to appear before the value
  • A plus (+) if the symbol is to appear after the value
  • A period (.) if the symbol replaces the radix character
CODESET LC_CTYPE Codeset name


Description

If the current locale does not have language information defined, the function returns information from the C locale. The program should not modify the string returned by the function. This string might be overwritten by subsequent calls to nl_langinfo .

If the setlocale function is called after a call to nl_langinfo , then the pointer returned by the previous call to nl_langinfo will be unspecified. In this case, the nl_langinfo function should be called again.


Return Values

x Pointer to the string containing the requested information. If item is invalid, the function returns an empty string.

Example


#include <stdio.h> 
#include <locale.h> 
#include <langinfo.h> 
 
/* This test sets up the British English locale, and then inquires on the */ 
/* data and time format, first day of the week, and abbreviated first     */ 
/* day of the week.                                                       */ 
 
#include <stdlib.h> 
#include <string.h> 
 
int main() 
{ 
    char *return_val; 
    char *nl_ptr; 
 
    /*   set the locale, with user supplied locale name                   */ 
 
    return_val = setlocale(LC_ALL, "en_gb.iso8859-1"); 
    if (return_val == NULL) { 
        printf("ERROR : The locale is unknown"); 
        exit(1); 
    } 
    printf("+-----------------------------------------------------+\n"); 
 
    /* Get the date and time format from the locale.                      */ 
 
    printf("D_T_FMT = "); 
 
    /*  Compare the returned string from nl_langinfo with an empty        */ 
    /* string.                                                            */ 
 
    if (!strcmp((nl_ptr = (char *) nl_langinfo(D_T_FMT)), "")) { 
 
        /* The string returned was empty this could mean that either      */ 
        /* 1) The locale does not contain a value for this item           */ 
        /* 2) The value for this item is an empty string                  */ 
 
        printf("nl_langinfo returned an empty string\n"); 
    } 
    else { 
        /* Display the date and time format                               */ 
 
        printf("%s\n", nl_ptr); 
    } 
 
    /* Get the full name for the first day of the week from locale        */ 
   printf("DAY_1 = "); 
 
    /*  Compare the returned string from nl_langinfo with an empty        */ 
    /* string.                                                            */ 
 
    if (!strcmp((nl_ptr = (char *) nl_langinfo(DAY_1)), "")) { 
 
        /* The string returned was empty this could mean that either      */ 
        /* 1) The locale does not contain a value for the first day of    */ 
        /* the week                                                       */ 
        /* 2) The value for the first day of the week is an empty string  */ 
 
        printf("nl_langinfo returned an empty string\n"); 
    } 
 
    else { 
        /* Display the full name of the first day of the week             */ 
 
        printf("%s\n", nl_ptr); 
    } 
   /* Get the abbreviated name for the first day of the week from locale */ 
 
    printf("ABDAY_1 = "); 
 
    /*  Compare the returned string from nl_langinfo with an empty       */ 
    /* string.                                                           */ 
 
    if (!strcmp((nl_ptr = (char *) nl_langinfo(ABDAY_1)), "")) { 
 
        /* The string returned was empty this could mean that either      */ 
        /* 1) The locale does not contain a value for the first day of    */ 
        /* the week                                                       */ 
        /* 2) The value for the first day of the week is an empty string  */ 
 
        printf("nl_langinfo returned an empty string\n"); 
    } 
 
    else { 
 
        /* Display the abbreviated name of the first day of the week     */ 
 
        printf("%s\n", nl_ptr); 
   } 
} 

Running the example program produces the following result:


+-----------------------------------------------------+ 
D_T_FMT = %a %e %b %H:%M:%S %Y 
DAY_1 = Sunday 
ABDAY_1 = Sun 


nrand48

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

Format

#include <stdlib.h>

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


Arguments

xsubi

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

Description

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

The nrand48 function returns nonnegative, long integers uniformly distributed over the range of y values, such that 0 <= y < 231 .

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 248 , 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 nrand48 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, the nrand48 function 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 functions are called by other modules.


Return Values

n Returns nonnegative, long integers over the range 0 <= y < 2 31 .


Previous Next Contents Index
  

1.800.AT.COMPAQ

privacy and legal statement