Previous | Contents | Index |
Move the cursor to coordinates (y,x) and insert the character ch into the specified window. The mvinsch function acts on the stdscr window.
#include <curses.h>int mvinsch (int y, int x, char ch);
int mvwinsch (WINDOW *win, int y, int x, char ch);
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.
After the character is inserted, each character on the line shifts to the right, and the last character on the line is deleted.
OK Indicates success. ERR Indicates that the function makes the screen scroll illegally. For more information, see the scrollok function in this section.
Move the cursor to coordinates (y,x) and insert the specified string into the specified window. The mvinsstr function acts on the stdscr window.
#include <curses.h>int mvinsstr (int y, int x, char *str);
int mvwinsstr (WINDOW *win, int y, int x, char *str);
win
A pointer to the window.y
A window coordinate.x
A window coordinate.str
The string that is displayed.
Each character after the string shifts to the right, and the last character disappears. The mvinsstr and mvwinsstr functions are specific to HP C for OpenVMS Systems and are not portable.
OK Indicates success. ERR Indicates that the function makes the screen scroll illegally. For more information, see the scrollok function.
Moves the starting position of the window to the specified (y,x) coordinates.
#include <curses.h>mvwin (WINDOW *win, int y, int x);
win
A pointer to the window.y
A window coordinate.x
A window coordinate.
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.
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.
High-resolution sleep (REALTIME). Suspends a process (or thread in a threaded program) from execution for the specified timer interval.
#include <time.h>int nanosleep (const struct timespec *rqtp, struct timespec *rmtp);
rqtp
A pointer to the timespec data structure that defines the time interval during which the calling process or thread is suspended.rmtp
A pointer to the timespec data structure that receives the amount of time remaining in the previously requested interval, or zero if the full interval has elapsed.
The nanosleep function suspends a process or thread until one of the following conditions is met:
- The time interval specified by the rqtp argument has elapsed.
- A signal is delivered to the calling process and the action is to invoke a signal-catching function or to terminate the process.
The suspension time may be longer than requested because the argument value is rounded up to an integer multiple of the sleep resolution or because of the scheduling of other activity by the system. Except when interrupted by a signal, the suspension time is not less than the time specified by the rqtp argument (as measured by the system clock, CLOCK_REALTIME).
The use of the nanosleep function has no effect on the action or blockage of any signal.
If the requested time has elapsed, the call was successful and the nanosleep function returns zero.
On failure, the nanosleep function returns - 1 and sets errno to indicate the failure. The function fails if it has been interrupted by a signal, or if the rqtp argument specified a nanosecond value less than 0 or greater than or equal to 1 billion.
If the rmtp argument is non-NULL, the timespec structure it references is updated to contain the amount of time remaining in the interval (the requested time minus the time actually slept).
If the rmtp argument is NULL, the remaining time is not returned.
See also clock_getres , clock_gettime , clock_settime , and sleep .
0 Indicates success. The requested time has elapsed. - 1 Indicates failure. The function call was unsuccessful or was interrupted by a signal; errno is set to one of the following values:
- EINTR -- The nanosleep function was interrupted by a signal.
- EINVAL -- The rqtp argument specified a nanosecond value less than 0 or greater than or equal to 1 billion.
Creates a new window with numlines lines and numcols columns starting at the coordinates (begin_y,begin_x) on the terminal screen.
#include <curses.h>WINDOW *newwin (int numlines, int numcols, int begin_y, int begin_x);
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). Therefore, 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.
x The address of the allocated window. ERR Indicates an error.
Returns the next machine-representable number following x in the direction of y.
#include <math.h>double nextafter (double x, double y);
float nextafterf (float x, float y);
long double nextafterl (long double x, long double y);
x
A real number.y
A real number.
The nextafter functions return the next machine-representable floating-point number following x in the direction of y. If y is less than x, nextafter returns the largest representable floating-point number less than x.
n The next representable floating-point value following x in the direction of y. HUGE_VAL Overflow; errno is set to ERANGE. NaN x or y is NaN; errno is set to EDOM.
Equivalent to the nextafter function, with exceptions noted in the Description.
#include <math.h>double nexttoward (double x, long double y);
float nexttowardf (float x, long double y);
long double nexttowardl (long double x, long double y);
x
A real number.y
A real number.
The nexttoward functions are equivalent to the corresponding nextafter functions, except that the second parameter has type long double and the functions return y converted to the type of the function if x equals y.
n The next representable floating-point value following x in the direction of y. y (of the type x) If x equals y. HUGE_VAL Overflow; errno is set to ERANGE. NaN x or y is NaN; errno is set to EDOM.
Increases or decreases process priority relative to the process current priority by the amount of the argument. This function is nonreentrant.
#include <unistd.h>int nice (int increment);
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.
When a process calls the vfork function, the resulting child inherits the parent's priority.With the DECC$ALLOW_UNPRIVILEGED_NICE feature logical enabled, the nice function exhibits its legacy behavior of not checking the privilege of the calling process (that is, any user may lower the nice value to increase process priorities). Also, when the caller sets a priority above MAX_PRIORITY, the nice value is set to the base priority.
With DECC$ALLOW_UNPRIVILEGED_NICE disabled, the nice function conforms to the X/Open standard of checking the privilege of the calling process (only users with ALTPRI privilege can lower the nice value to increase process priorities), and when the caller sets a priority above MAX_PRIORITY, the nice value is set to MAX_PRIORITY.
See also vfork .
0 Indicates success. - 1 Indicates failure.
Returns the nearest integral value to the argument.
#include <math.h>double nint (double x);
float nintf (float x,);
long double nintl (long double x);
x
A real number.
The nint functions return the nearest integral value to x, except halfway cases are rounded to the integral value larger in magnitude. This corresponds to the Fortran generic intrinsic function nint .
n The nearest integral value to x. NaN x is NaN; errno is set to EDOM.
The nl and nonl functions are provided only for UNIX software compatibility and have no function in the OpenVMS environment.
#include <curses.h>void nl (void);
void nonl (void);
Returns a pointer to a string that contains information obtained from the program's current locale.
#include <langinfo.h>char *nl_langinfo (nl_item item);
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 nonmonetary 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
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.
x Pointer to the string containing the requested information. If item is invalid, the function returns an empty string.
#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
Previous | Next | Contents | Index |