VMS Help
CC, Run-time functions
*Conan The Librarian (sorry for the slow response - running on an old VAX)
|
|
Note: You might have a newer version of Compaq C that has header
files and documentation for functions that are not supported on
your older OpenVMS system. For example, if your target operating
system platform is OpenVMS Version 7.2, you cannot use Compaq C RTL
functions that are introduced on OpenVMS Version 7.3, even though
they are documented in this help and in the Compaq C RTL Reference
manual.
See Appendix of the Compaq C Run-Time Library Reference Manual for
a series of tables that list what DEC C RTL functions are supported
on recent OpenVMS versions. This is helpful for determining the
functions to avoid using on your target OpenVMS platforms.
In the Curses Screen Management Package, there are pairs of
functions and macros with equivalent functionality. Many Curses
functions and macros are expressed as follows:
[w]addch
[no]echo
The descriptions of the addch macro and the waddch function are
found under the heading, [w]addch. The descriptions of the macros
echo and noecho are found under the heading, [no]echo. For more
information about Curses Screen management functions and macros,
see HELP CC RUN-TIME_FUNCTIONS CURSES and HELP CC LINK_LIBRARIES.
All other library functions are listed alphabetically under
separate headings.
All library functions are reentrant unless explicitly stated
otherwise.
Sends the signal SIGABRT that terminates the process.
Syntax:
#include <stdlib.h>
void abort(void);
Returns the absolute value of an integer.
Syntax:
#include <stdlib.h>
int abs(int integer);
Checks a file to see if a specified access mode is allowed.
Syntax:
#include <unistd.h>
int access(const char *file_spec, int mode);
The mode is interpreted as follows:
F_OK -- Test to see if the file exists
X_OK -- Execute
W_OK -- Write (implies delete access)
R_OK -- Read
Returns a value in the range 0 to pi, which is the arc cosine of
its radian argument.
Syntax:
#include <math.h>
double acos(double x);
Curses Screen Management function and macro that add the character
ch to the window at the current position of the cursor. The addch
macro operates on the stdscr window.
Syntax:
#include <curses.h>
int addch(char ch);
int waddch(WINDOW *win, char ch);
Curses Screen management function and macro that add the string
pointed to by str to the window at the current position of the
cursor. The addstr macro operates on the stdscr window.
Syntax:
#include <curses.h>
int addstr(char *str);
int waddstr(WINDOW *win, char *str);
Sends the signal SIGALRM to the invoking process after the number
of seconds indicated by its argument has elapsed. This function is
nonreentrant.
Syntax:
#include <unistd.h>
unsigned int alarm(unsigned int seconds); (POSIX-1)
int alarm(unsigned int seconds); (Compatibility)
Converts a broken-down time into a 26-character string in the
following form:
Sun Sep 16 01:03:52 1984\n\0
All fields have a constant width.
asctime_r puts the result into a user-specified buffer.
asctime puts the result into thread-specific static memory
allocated by the Compaq C RTL, which can be overwritten by
subsequent calls to ctime or asctime; you must make a copy if you
want to save it.
Syntax:
#include <time.h>
char *asctime(const struct tm *timeptr);
char *asctime_r(const struct tm *timeptr, char *buffer);
[posix1]
Returns a value in the range -pi/2 to pi/2, which is the arc sine
of its radian argument.
Syntax:
#include <math.h>
double asin(double x);
Used to implement run-time diagnostics in programs.
Syntax:
#include <assert.h>
void assert(int expression);
Returns a value in the range -pi/2 to pi/2, which is the arc
tangent of its radian argument.
Syntax:
#include <math.h>
double atan(double x);
Returns a value in the range -pi to pi, which is the arc tangent of
x/y, where x and y are the two arguments.
Syntax:
#include <math.h>
double atan2(double x, double y);
Registers a function that is called without arguments at program
termination.
Syntax:
#include <stdlib.h>
int atexit(void (*func) (void));
Converts a character string to a double-precision number. The
character string has the following form:
[white-spaces][+|-]digits[radix-character][digits][e|E[+|-]integer]
Where radix-character is defined in the current locale.
The first unrecognized character ends the conversion.
The string is interpreted by the same rules that are used to
interpret floating constants.
Syntax:
#include <stdlib.h>
double atof(const char *nptr);
Converts strings of ASCII characters to the appropriate numeric
values. The ASCII string has the following form:
[white-spaces][+|-]digits
This function does not account for overflow resulting from the
conversion.
Syntax:
#include <stdlib.h>
int atoi(const char *nptr);
Converts strings of ASCII characters to the appropriate numeric
values. The ASCII string has the following form:
[white-spaces][+|-]digits
The function does not account for overflow resulting from the
conversion.
Syntax:
#include <stdlib.h>
long int atol(const char *nptr);
Returns the last component of a path name.
Syntax:
#include <libgen.h>
char *basename (char *path);
Compares byte strings.
Syntax:
#include <strings.h>
void bcmp (const void *string1,
const void *string2,
size_t length);
Copies byte strings.
Syntax:
#include <strings.h>
void bcopy (const void *source,
void *destination,
size_t length);
Curses Screen Management function that draws a box around the
window using the character vert as the character for drawing the
vertical lines of the rectangle, and hor for drawing the horizontal
lines of the rectangle.
Syntax:
#include <curses.h>
int box(WINDOW *win, char vert, char hor);
Determines the lowest virtual address that is not used with the
program.
Syntax:
#include <stdlib.h>
void *brk(unsigned long int addr);
Performs a binary search. It searches an array of sorted objects
for a specified object.
Syntax:
#include <stdlib.h>
void *bsearch (const void *key,
const void *base,
size_t nmemb,
size_t size,
int (*compar) (const void *, const void *));
Converts one-byte multibyte character to a wide character in the
initial shift state.
Syntax:
#include <wchar.h>
wint_t btowc (int c);
Copies nulls into byte strings.
Syntax:
#include <strings.h>
void bzero (void *string, size_t length);
Computes the Euclidean distance between two points as the square
root of their respective squares. This function returns
sqrt(x*x + y*y).
Syntax:
#include <math.h>
double cabs(cabs_t z);
Allocates an area of zeroed memory. This function is
AST-reentrant.
Syntax:
#include <stdlib.h>
void *calloc(size_t number, size_t size);
Closes a message catalog.
Syntax:
#include <nl_types.h>
int catclose (nl_catd catd);
Retrieves a message from a message catalog.
The message identified by set_id and msg_id, in the message catalog
catd, is retrieved The message is stored in a message buffer in the
nl_catd structure which is overwritten by subsequent calls to
catgets. If a message string needs to be preserved, it should be
copied to another location by the program.
Syntax:
#include <nl_types.h>
char *catgets (nl_catd catd, int set_id, int msg_id, const
char *s);
Opens a message catalog.
Syntax:
#include <nl_types.h>
nl_catd catopen (const char *name, int oflag);
Returns (as a double) the smallest integer that is greater than or
equal to its argument.
Syntax:
#include <math.h>
double ceil(double x);
Makes available for reallocation the area allocated by a previous
calloc, malloc, or realloc call. This function is AST-reentrant.
Syntax:
#include <stdlib.h>
void cfree(void *pointer);
Changes the default directory.
Syntax:
#include <unistd.h>
int chdir(const char *dir_spec); (POSIX-1)
int chdir(const char *dir_spec, ...); (Compaq C Extension)
where the ... is an optional flag, available in all compilation
modes except strict ANSI C mode (/STANDARD=ANSI89). This flag is
significant only when calling chdir from USER mode. If the value
of the flag is 1, the new directory is effective across images. If
the value is not 1, the original default directory is restored when
the image exits.
Changes the file protection of a file.
Syntax:
#include <stat.h>
int chmod(const char *file_spec, mode_t mode);
Changes the owner UIC of a file.
Syntax:
#include <unistd.h>
int chown(const char *file_spec, uid_t owner,
gid_t group); (POSIX-1)
int chown(const char *file_spec, unsigned int owner,
unsigned int group); (Compatibility)
Curses Screen Management function and macro that erase the contents
of the specified window and reset the cursor to coordinates (0,0).
The clear macro acts on the stdscr window.
Syntax:
#include <curses.h>
int clear();
int wclear(WINDOW *win);
Resets the error and end-of-file indicators for a file (so that
ferror and feof will not return a nonzero value).
Syntax:
#include <stdio.h>
void clearerr(FILE *file_pointer);
Sets the clear flag for the window.
Syntax:
#include <curses.h>
clearok(WINDOW *win, bool boolf);
Determines the amount of CPU time (in 10-millisecond units) used
since the beginning of program execution. The time reported is the
sum of the user and system times of the calling process and any
terminated child processes for which the calling process has
executed wait or system. This function is nonreentrant.
Syntax:
#include <time.h>
clock_t clock(void);
Closes the file associated with a file descriptor.
Syntax:
#include <unistd.h>
int close(int file_descriptor);
Closes directories.
Syntax:
#include <dirent.h>
int closedir (DIR *dir_pointer);
Curses Screen Management function and macro that deactivate the
video display attributes boldface, blinking, reverse video, and
underlining within a specified window on the terminal screen. The
attributes are represented by _BOLD, _BLINK, _REVERSE, and
_UNDERLINE. The clrattr macro operates on the stdscr window.
Syntax:
#include <curses.h>
int clrattr(int attr);
int wclrattr(WINDOW *win, int attr);
Curses Screen Management function and macro that erase the contents
of the window from the current position of the cursor to the bottom
of the window. The clrtobot macro acts on the stdscr window.
Syntax:
#include <curses.h>
int clrtobot();
int wclrtobot(WINDOW *win);
Curses Screen Management function and macro that erase the contents
of the window from the current cursor position to the end of the
line on the specified window. The clrtoeol macro acts on the
stdscr window.
Syntax:
#include <curses.h>
int clrtoeol();
int wclrtoeol(WINDOW *win);
Determines the current value of a specified system variable defined
by a string value.
Syntax:
#include <unisted.h>
size_t confstr (int name, char *buf, size_t len);
Returns the cosine of its radian argument.
Syntax:
#include <math.h>
double cos(double x);
Returns the hyperbolic cosine of its argument.
Syntax:
#include <math.h>
double cosh(double x);
Returns the cotangent of its radian argument.
Syntax:
#include <math.h>
double cot(double x);
Creates a new file.
Syntax:
#include <fcntl.h>
int creat(const char *file_spec, mode_t mode); (POSIX-1)
int creat(const char *file_spec, mode_t mode,...); (Compaq C
Extension)
where the ... is an optional argument list of character strings of
the following form:
"keyword = value",...,"keyword = value"
Or in the case of "acc" or "err", this form:
"keyword"
The keyword is an RMS field in the file access block (FAB) or
record access block (RAB), and the value is valid for assignment to
that field. Some fields permit you to specify more than one value.
In these cases, the values are separated by commas.
Curses Screen Management macros that set and unset the terminal
from cbreak mode. This mode of single-character input is only
supported with the Curses input routine getch.
Syntax:
#include <curses.h>
crmode()
nocrmode()
Returns a character string giving the equivalence string of
SYS$COMMAND. This is the name of the controlling terminal. This
function is nonreentrant.
Syntax:
#include <unistd.h>
char *ctermid(char *str);
Converts a time, in seconds, to the following form:
Sun Sep 16 01:03:52 1984\n\0
All fields have a constant width.
ctime_r puts the result into a user-specified buffer.
ctime puts the result into thread-specific static memory allocated
by the Compaq C RTL, which can be overwritten by subsequent calls
to ctime or asctime; you must make a copy if you want to save it.
Syntax:
#include <time.h>
char *ctime(const time_t *bintim);
char *ctime_r(const time_t *bintim, char *buffer); [posix1]
Curses, the Compaq C Screen Management Package, is comprised of RTL
functions that create and modify defined sections of the terminal
screen, and optimize cursor movement. Using a screen management
package, you can develop a user interface that is both visually
attractive and easy to use. Curses allows you to manipulate the
screen without worrying about the intricacies of various types of
terminals, the difficulties of moving data to and from sections of
the screen, or the problems of efficient cursor movement.
Using Curses, the terminal screen may be divided into a number of
rectangular regions called windows. The size and location of each
window is given in terms of the number of lines, the number of
columns, and the starting position -- the upper left corner of the
window. A window must fit completely on the terminal screen, being
as small as a single character or as large as the entire terminal
screen. When modifying windows, changes will not appear on the
terminal screen until the window is refreshed. When a window is
refreshed, the updated window is placed onto the terminal screen
leaving the rest of the terminal screen unaltered.
Returns a pointer to a character string containing the name of the
user initiating the current process. This function is
nonreentrant.
Syntax:
#include <unistd.h>
char *cuserid(char *str);
Allows you to call the Compaq C RTL from other languages. It
initializes the run-time environment and establishes both an exit
and condition handler. VAXC$CRTL_INIT is a synonym for
DECC$CRTL_INIT. Either name invokes the same routine.
Syntax:
#include <signal.h>
void DECC$CRTL_INIT(void);
Converts OpenVMS binary system times to UNIX binary times.
Syntax:
#include <unixlib.h>
unsigned int decc$fix_time(void *vms_time);
Converts OpenVMS file specifications to UNIX style file
specifications.
Syntax:
#include <unixlib.h>
int decc$from_vms(const char *vms_filespec, int
action_routine, int wild_flag);
Matches a string to a pattern.
Syntax:
#include <unixlib.h>
int decc$match_wild(char *test_string, char *string_pattern);
Converts UNIX style file specifications to OpenVMS file
specifications.
Syntax:
#include <unixlib.h>
int decc$to_vms(const char *unix_style_filespec,
int (*action_rtn)(char *unix_style_filespec,
int type_of_file), int allow_wild, int no_directory);
Provides additional flexibility in manipulating and observing RMS
structures on a per-read basis. This function is inherently
specific to OpenVMS systems and should not be used when writing
portable applications.
Syntax:
#include <stdio.h>
int decc$record_read(FILE *fp, void *buffer, int nbytes);
Provides additional flexibility in manipulating and observing RMS
structures on a per-write basis.
Syntax:
#include <stdio.h>
int decc$record_write(FILE *fp, void *buffer, int nbytes);
61 - decc$set_child_standard_streams
|
For a child spawned by a function from the exec family of
functions, associates specified file descriptors with a child's
standard streams: stdin, stdout, and stderr.
Syntax:
#include <unistd.h>
int decc$set_child_standard_streams(int fd1, int fd2,
int fd3);
Controls the type of reentrancy that reentrant Compaq C RTL
routines will exhibit.
Syntax:
#include <reentrancy.h>
int decc$set_reentrancy(int type);
Use one of the following values for type:
o C$C_AST (AST)
Uses the _BBSSI builtin to perform simple locking around
critical sections of RTL code, and it may additionally disable
asynchronous system traps (AST)s in locked regions of code.
This type of locking should be used when AST code contains
calls to Compaq C RTL I/O routines.
o C$C_MULTITHREAD (multithread)
Designed to be used in conjunction with the DECthreads product.
It performs DECthreads locking and never disables ASTs.
DECthreads must be available on your system to use this form of
reentrancy.
o C$C_TOLERANT (tolerant)
Uses the _BBSSI builtin to perform simple locking around
critical sections of RTL code, but ASTs are not disabled. This
type of locking should be used when ASTs are used and must be
delivered immediately. TOLERANT is the default reentrancy
type.
o C$C_NONE (none)
Gives optimal performance in the Compaq C RTL, but does
absolutely no locking around critical sections of RTL code. It
should only be used in a single-threaded environment when there
is no chance that the thread of execution will be interrupted
by an AST that would call the Compaq C RTL.
Translates OpenVMS file specifications to UNIX style file
specifications.
Syntax:
#include <unixlib.h>
char *decc$translate_vms(const char *vms_filespec);
Validates its argument as a valid wide character in the current
program's locale.
Syntax:
#include <wchar.h>
int decc$validate_wchar(wchar_t wc);
65 - decc$write_eof_to_mbx
|
Writes an end-of-file message to the mailbox.
Syntax:
#include <unistd.h>
int decc$write_eof_to_mbx(int fd);
Curses Screen Management function and macro that delete the
character on the specified window at the current position of the
cursor. The delch macro operates on the stdscr window.
Syntax:
#include <curses.h>
int delch();
int wdelch(WINDOW *win);
Deletes a file.
Syntax:
#include <unixio.h>
int delete(const char *file_spec);
Curses Screen Management function and macro that delete the line at
the current position of the cursor. The deleteln macro acts on the
stdscr window.
Syntax:
#include <curses.h>
int deleteln();
int wdeleteln(WINDOW *win);
Deletes the specified window from memory.
Syntax:
#include <curses.h>
int delwin(WINDOW *win);
Computes the difference, in seconds, between the two times
specified by the time1 and time2 arguments.
Syntax:
#include <time.h>
double difftime (time_t time2, time_t time_1);
Reports the parent directory name of a file path name.
Syntax:
#include <libgen.h>
char *dirname (char *path);
Returns the quotient and remainder after the division of its
arguments.
Syntax:
#include <stdlib.h>
div_t div(int numer, int denom);
deallocates the address space allocated by the Compaq C RTL for the
handle.
There is no way on OpenVMS systems to "unload" a shareable image
that was dynamically loaded by the LIB$FIND_IMAGE_SYMBOL routine,
which is the routine called by the dlsym function. In other words,
there is no way on OpenVMS systems to release the address space
occupied by the shareable image brought into memory by dlsym.
Syntax:
#include <stdio.h>
void dlclose(void *handle);
Returns a string describing the last error that occurred from a
call to dlopen, dlclose, or dlsym.
Syntax:
#include <stdio.h>
char *dlerror(void);
Provides an interface to the dynamic library loader to allow
shareable images to be loaded and called at run time.
The dlopen function does not load a shareable image but rather
saves its pathname argument for subsequent use by the dlsym
function, which actually loads the shareable image through a call
to LIB$FIND_IMAGE_SYMBOL.
Syntax:
#include <stdio.h>
void *dlopen(char *pathname, int mode);
Returns the address of the symbol name found in a shareable image.
If the symbol is not found, a NULL pointer is returned.
Syntax:
#include <stdio.h>
void *dlsym(void *handle, char *name);
Generate uniformly distributed pseudorandom number sequences.
Returns 48-bit, nonnegative, double-precision floating-point
values.
Syntax:
#include <stdlib.h>
double drand48 (void);
Allocates a new file descriptor that refers to a file specified by
a file descriptor returned by open, creat, or pipe.
Syntax:
#include <unistd.h>
int dup(int file_desc1);
Makes file_descriptor_2 point to the same file as
file_descriptor_1.
Syntax:
#include <unixio.h>
int dup2(int file_descriptor_1, int file_descriptor_2);
Curses Screen Management macros that set the terminal so that
characters may or may not be echoed on the terminal screen. This
mode of single-character input is only supported with Curses.
Syntax:
#include <curses.h>
echo()
noecho()
Converts its value argument to a null-terminated string of ASCII
digits and returns the address of the string. The string is stored
in a memory location created by the function.
Syntax:
#include <stdlib.h>
char *ecvt(double value, int ndigit, int *decpt, int *sign);
Curses Screen Management function that clears the terminal screen
and frees any virtual memory allocated to Curses data structures.
Syntax:
#include <curses.h>
void endwin(void);
Generate uniformly distributed pseudorandom number sequences.
Returns 48-bit nonnegative, double-precision, floating-point
values.
Syntax:
#include <stdlib.h>
double erand48 (unsigned short int xsubi[3]);
Curses Screen Management function and macro that erase the window
by painting it with blanks. The erase macro acts on the stdscr
window.
Syntax:
#include <curses.h>
int erase();
int werase(WINDOW *win);
Passes the name of an image to be activated on a child process.
This function is nonreentrant.
Syntax:
#include <unistd.h>
int execl (const char *file-spec, const char *arg0,..., (char
*)0; (POSIX-1)
int execl (char *file-spec,...); (Compatibility)
where the ... is a sequence of pointers to strings. At least one
pointer must exist to terminate the list. This pointer must be the
null pointer.
Passes the name of an image to be activated on a child process.
This function is nonreentrant.
Syntax:
#include <unistd.h>
int execle (char *file-spec, char *argn,..., (char *)0, char
*envp[]); (POSIX-1)
int execle (char *file-spec,...); (Compatibility)
Passes the name of an image to be activated on a child process.
This function is nonreentrant.
Syntax:
#include <unistd.h>
int execlp (const char *file-spec, const char *arg0,...,(char
*)0); (POSIX-1)
int execlp (char *file-spec,...); (Compatibility)
Passes the name of an image to be activated on a child process.
This function is nonreentrant.
Syntax:
#include <unistd.h>
int execv (char *file-spec, char *argv[]);
Passes the name of an image to be activated on a child process.
This function is nonreentrant.
Syntax:
#include <unistd.h>
int execve (const char *file-spec, char *argv[], char
*envp[]);
Passes the name of an image to be activated on a child process.
This function is nonreentrant.
Syntax:
#include <unistd.h>
int execvp (const char *file-spec, char *argv[]);
Terminate execution of the program from which they are called.
These functions are nonreentrant. They are also identical; the
_exit function is retained for reasons of compatibility with VAX C.
The status argument corresponds with an errno value if exiting from
a child process using vfork and/or an exec function, or with an
OpenVMS condition value if exiting from a process invoked by DCL.
The errno values are defined in the <errno.h> header file. A
status value of 0 or EXIT_SUCCESS is translated to the OpenVMS
SS$_NORMAL status code to return the OpenVMS success value. Any
other status value is left the same. The status value is passed to
the parent process. A status value of EXIT_FAILURE is translated
to an error-level exit status.
If the process was invoked by the DIGITAL Command Language (DCL),
the status is interpreted by DCL and a message is displayed. If
the process was a child process created using vfork or an exec
function, then the child process is executed and control returns to
the parent.
The exit and _exit functions make use of the $EXIT system service.
If your process is being invoked by the RUN command using any of
the hibernation and scheduled wakeup qualifiers, the process might
not correctly return to hibernation state when an exit or _exit
call is made.
Syntax:
#include <stdlib.h>
void exit(int status)
#include <unistd.h>
void _exit(int status);
Returns the base e raised to the power of the argument.
Syntax:
#include <math.h>
double exp(double x);
Returns the absolute value of a floating-point value.
Syntax:
#include <math.h>
double fabs(double x);
Changes the owner and group of a file.
Syntax:
#include <unistd.h>
int fchown(int fildes, uid_t owner, gid_t group);
Closes a file by flushing any buffers associated with the file
control block and freeing the file control block and buffers
previously associated with the file pointer.
Syntax:
#include <stdio.h>
int fclose(FILE *file_pointer);
Performs controlling operations on an open file specified by the
file_desc parameter. The values for the request parameter are
defined in the <fcntl.h> header file.
Syntax:
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
int fcntl(int file_desc, int request [, int file_desc2]);
Converts its value argument to a null-terminated string of ASCII
digits and returns the address of the string.
Syntax:
#include <stdlib.h>
char *fcvt(double value, int ndigit, int *decpt, int *sign);
Associates a file pointer with a file descriptor returned by an
open, creat, dup, dup2, or pipe function.
Syntax:
#include <stdio.h>
FILE *fdopen(int file_descriptor, char *a_mode);
Tests a file to see if the end-of-file has been reached.
Syntax:
#include <stdio.h>
int feof(FILE *file_pointer);
Returns a nonzero integer if an error occurred while reading or
writing to a file.
Syntax:
#include <stdio.h>
int ferror(FILE *file_pointer);
Writes out any buffered information for the specified file.
Syntax:
#include <stdio.h>
int fflush(FILE *file_pointer);
Finds the index of the first bit in a string.
Syntax:
#include <strings.h>
int ffs (int integer);
Returns the next character from a specified file.
Syntax:
#include <stdio.h>
int fgetc(FILE *file_pointer);
Returns the file specification associated with a file pointer.
Syntax:
#include <stdio.h>
char *fgetname(FILE *file_pointer, char *buffer,...);
where the ... is an optional additional argument that can be
either 1 or 0. If you specify 1, fgetname returns the file
specification in OpenVMS format. If you specify 0, fgetname
returns the file specification in UNIX style format.
If this argument is omitted, fgetname returns the file name
according to your current command language interpreter.
Stores the current value of the file position indicator for the
stream pointed to by the stream into the object pointed to by pos.
Syntax:
#include <stdio.h>
int fgetpos(FILE *stream, fpos_t *pos);
Reads a line from a specified file, up to one less than the
specified maximum number of characters or up to and including the
new-line character, whichever comes first. The string is stored in
the argument str.
Syntax:
#include <stdio.h>
char *fgets(char *str, int maxchar, FILE *file_ptr);
Reads the next character from a specified file, and converts it to
a wide-character code.
Syntax:
#include <wchar.h>
wint_t fgetwc (FILE *file_ptr);
Reads a line of wide characters from a specified file. and stores
them in an array pointed to by wstr.
The function reads up to maxchar - 1 characters or until the
newline character is encountered. The function terminates the line
with a null wide character.
Syntax:
#include <wchar.h>
wchar_t *fgetws (wchar_t *wstr, int maxchar, FILE *file_ptr);
Returns the file descriptor associated with the specified file
pointer.
Syntax:
#include <stdio.h>
int fileno(FILE *file_pointer);
Returns (as a double) the largest integer that is less than or
equal to its argument.
Syntax:
#include <math.h>
double floor(double x);
Computes the floating-point remainder of the first argument divided
by the second. If the second argument is zero, the fuction returns
zero.
Syntax:
#include <math.h>
double fmod (double x, double y);
Opens a file by returning the address of a FILE structure.
Syntax:
#include <stdio.h>
FILE *fopen(const char *file_spec, const char *a_mode); (ANSI
C)
FILE *fopen(const char *file_spec, const char *a_mode ,...);
(Compaq C Extension)
where the ... represents optional file attribute arguments. The
file attribute arguments are the same as those used in the creat
function.
Retrieves file implementation characteristics.
Syntax:
#include <unistd.h>
long int fpathconf (int filedes, int name);
Performs formatted output to a specified file.
Syntax:
#include <stdio.h>
int fprintf(FILE *file_pointer, const char
*format_string,...);
The ... represents optional expressions whose resultant types
correspond to conversion specifications given in the format_string.
If no conversion specifications are given, you can omit the output
sources. Otherwise, the function calls must have exactly as many
output sources as there are conversion specifications, and the
conversion specifications must match the types of the output
sources. Conversion specifications are matched to output sources
in left-to-right order.
The format string for the output of information can contain two
kinds of items:
o Ordinary characters, which are copied to the output.
o Conversion specifications, each of which causes the conversion
of a corresponding output source to a character string in a
particular format. Conversion specifications are matched to
output sources in left-to-right order.
A conversion specification consists of a % (or a %n$), followed by
one or more optional characters, and concluding with a conversion
specifier.
114.1 - Optional character
flags You can use the following flag characters, alone or in
any combined order, to modify the conversion
specification:
' Requests that a numeric conversion is
formatted with the thousands separator
character. Only the numbers to the left of
the radix character are formatted with the
separator character. The character used as
a separator and the positioning of the
separators are defined in the program's
current locale.
-(hyphen) Left-justifies the converted output source
in its field.
+ Requests that an explicit sign be present on
a signed conversion. If this flag is not
specified, the result of a signed conversion
begins with a sign only when a negative
value is converted.
space Prefixes a space to the result of a signed
conversion, if the first character of the
conversion is not a sign, or if the
conversion results in no characters. If you
specify both the space and the + flag, the
space flag is ignored.
# Requests an alternate form conversion.
Depending on the conversion specified,
different actions will occur. For the o
(octal) conversion, the precision is
increased to force the first digit to be a
0. For the x (or X) conversion, a nonzero
result is prefixed with 0x (or 0X). For e,
E, f, g, and G conversions, the result
contains a decimal point even at the end of
an integer value. For g and G conversions,
trailing zeros are not trimmed. For other
conversions, the effect of # is undefined.
0 Uses zeros rather than spaces to pad the
field width for d, i, o, u, x, X, e, E, f,
g, and G conversions. If both the 0 and the
- flags are specified, then the 0 flag is
ignored. For d, i, o, u, x, and X
conversions, if a precision is specified,
the 0 flag is ignored. For other
conversions, the behavior of the 0 flag is
undefined.
field width The minimum field width can be designated by a decimal
integer constant, or by an output source. To specify
an output source, use an asterisk (*) or the sequence
*n$, where n refers to the nth output source listed
after the format specification. If the converted
output source is wider than the minimum field, write
it out. If the converted output source is narrower
than the minimum width, pad it to make up the field
width. Pad with spaces, by default. Pad with zeros
if the 0 flag is specified; this does not mean that
the width is an octal number. Padding is on the left
by default, and on the right if a minus sign is
specified.
period (.) Separates the field width from the precision.
precision The precision defines the minimum number of digits to
appear for d, i, o, u, x, and X conversions; the
number of digits to appear after the decimal-point
character for e, E, and f conversions; the maximum
number of significant digits for g and G conversions;
or the maximum number of characters to be written from
a string in an s or S conversion. If a precision
appears with any other conversion specifier, the
behavior is undefined.
Precision can be designated by a decimal integer
constant, or by an output source. To specify an
output source, use an asterisk (*) or the sequence
*n$, where n refers to the nth output source listed
after the format specification.
If only the period is specified, the precision is
taken as 0.
h, l, or L An h specifies that a following d, i, o, u, x, or X
conversion specifier applies to a short int or
unsigned short int argument; an h can also specify
that a following n conversion specifier applies to a
pointer to a short int argument.
An l (lowercase ell) specifies that a following d, i,
o, u, x, or X conversion specifier applies to a long
int or unsigned long int argument; an l can also
specify that a following n conversion specifier
applies to a pointer to a long int argument.
An L specifies that a following e, E, f, g, or G
conversion specifier applies to a long double
argument.
If an h, l, or L appears with any other conversion
specifier, the behavior is undefined.
On Compaq C for OpenVMS VAX and Alpha Systems, int
values are equivalent to long values.
114.2 - Conversion Specifier
d, i Converts an int argument to signed decimal format.
o Converts an unsigned int argument to unsigned octal
format.
u Converts an unsigned int argument to unsigned decimal
format (giving a number in the range 0 to 4,294,967,295).
x, X Converts an unsigned int argument to unsigned hexadecimal
format (with or without a leading 0x). The letters
'abcdef' are used for the x conversion; the letters
'ABCDEF' are used for the X conversion.
f Converts a float or double argument to the format
[-]mmm.nnnnnn. The number of n's is equal to the
precision specification. If no precision is specified,
the default is 6.
If the precision is 0 and the # flag is specified, the
decimal point appears but no n's appear. If the precision
is 0 and the # flag is not specified, the decimal point
also does not appear. If a decimal point appears, at
least one digit appears before it. The value is rounded
to the appropriate number of digits.
e, E Converts a float or double argument to the format
[-]m.nnnnnnE[+|-]xx. The number of n's is specified by
the precision. If no precision is specified, the default
is 6. If the precision is explicitly 0 and the # flag is
specified, the decimal point appears but no n's appear.
If the precision is explicitly 0 and the # flag is not
specified, the decimal point also does not appear. An 'e'
is printed for e conversion; an 'E' is printed for E
conversion. The exponent always contains at least two
digits. If the value is 0, the exponent is 0.
g, G Converts a float or double argument to format f or e (or E
if the G conversion specifier is used), with the precision
specifying the number of significant digits. If the
precision is 0, it is taken as 1. The format used depends
on the value of the argument: format e (or E) is used
only if the exponent resulting from such a conversion is
less than -4, or is greater than or equal to the
precision; otherwise, format f is used. Trailing zeros
are suppressed in the fractional portion of the result. A
decimal point appears only if it is followed by a digit.
c Converts an int argument to an unsigned char, and writes
the resulting character (null characters are ignored).
C Converts a wchar_t argument to an array of bytes
representing the character, and writes the resulting
character. If the field width is specified and the
resulting character occupies fewer bytes than the field
width, it will be padded to the given width with space
characters. If the precision is specified, the behavior
is undefined.
s Requires an argument that is a pointer to an array of
characters of type char. The argument is used to write
characters until a null character is encountered or until
the number of characters indicated by the precision
specification is exhausted. If the precision
specification is 0 or omitted, all characters up to a null
are output.
S Converts an array of wide-character codes to multibyte
characters, and writes the multibyte characters. Requires
an argument that is a pointer to an array of wide
characters of type wchar_t. Characters are written until
a null wide character is encountered or until the number
of bytes indicated by the precision specification is
exhausted. If the precision specification is omitted or
is greater than the size of the array of converted bytes,
the array of wide characters must be terminated by a null
wide character.
p Requires an argument that is a pointer to void. The value
of the pointer is output as a hexadecimal character.
n Requires an argument that is a pointer to an integer. The
integer is assigned the number of characters written to
the output stream so far by this call to the formatted
output function. No argument is converted.
% Writes out the percent symbol. No conversion is
performed. The complete conversion specification would be
%%.
Writes a character to a specified file.
Syntax:
#include <stdio.h>
int fputc(int character, FILE *file_pointer);
Writes a character string to a file without copying the string's
null terminator.
Syntax:
#include <stdio.h>
int fputs(const char *string, FILE *file_pointer);
Converts a wide character to its corresponding multibyte value,
returns the result, and writes the result to the specified file.
Syntax:
#include <wchar.h>
wint_t fputwc (wint_t wc, FILE *file_ptr);
Converts a wide-character string to a to a multibyte character
string and writes it to the specified file.
The function does not append a terminating null byte, corresponding
to the null wide-character, to the output string.
Syntax:
#include <wchar.h>
int fputws (const wchar_t *wstr, FILE *file_ptr);
Reads a specified number of items from a file.
Syntax:
#include <stdio.h>
size_t fread(void *pointer, size_t size_of_item,
size_t number_of_items, FILE *file_pointer);
Makes available for reallocation the area allocated by a previous
calloc, malloc, or realloc call. This function is AST-reentrant.
Syntax:
#include <stdlib.h>
void free(void *pointer);
Substitutes the file, named by a file specification, for the open
file addressed by a file pointer. The latter file is closed.
Syntax:
#include <stdio.h>
FILE *freopen(const char *file_spec, const char *access_mode,
FILE *file_pointer,...);
Where the ... represents optional file attribute arguments. The
file attribute arguments are the same as those used in the creat
function.
Calculates the fractional and exponent parts of a double value.
The fractional part is returned as the return value; the exponent
is placed in the integer variable pointed to by eptr.
Syntax:
#include <math.h>
double frexp(double value, int *eptr);
Performs formatted input from a specified file.
Syntax:
#include <stdio.h>
fscanf(FILE *file_pointer, const char *format_string,...);
The ... represents optional expressions that are pointers to
objects whose results correspond to conversion specifications given
in the format_string. If no conversion specifications are given,
you can omit the input pointers. Otherwise, the function calls
must have exactly as many input pointers as there are conversion
specifications, and the conversion specifications must match the
types of the input pointers. Conversion specifications are matched
to input sources in left-to-right order.
The format_string for the input of information can include three
kinds of items:
o White-space characters (spaces, tabs, and new-line characters),
which match optional white-space characters in the input field.
o Ordinary characters (not %), which must match the next
nonwhite-space character in the input.
o Conversion specifications, which govern the conversion of the
characters in an input field and their assignment to an object
indicated by a corresponding input pointer.
A conversion specification consists of the following characters, in
the order listed:
o A percent character (%) or the sequence %n$ (where n is an
integer).
The sequence %n$ denotes that the conversion is applied to
the nth input pointer listed, where n is a decimal integer
between [1, NL_ARGMAX] (see the <limits.h> header file).
For example, a conversion specification beginning %5$ means
that the conversion will be applied to the 5th input
pointer listed after the format specification. The
sequence %$ is invalid. If the conversion specification
does not begin with the sequence %n$ the conversion
specification is matched to its input pointer in
left-to-right order. You should only use one type of
conversion specification (% or %n$) in a format
specification.
o One or more optional characters
o A conversion specifier.
123.1 - Optional character
* Assignment-suppressing character.
field width Nonzero decimal integer that specifies the maximum
field width.
h, l, or L Precede a conversion specifier of d, i, or n with an h
if the corresponding argument is a pointer to short int
rather than a pointer to int, or with an l (lowercase
ell) if it is a pointer to long int.
Similarly, precede a conversion specifier of o, u, or x
with an h if the corresponding argument is a pointer to
unsigned short int rather than a pointer to unsigned
int, or with an l (lowercase ell) if it is a pointer to
unsigned long int.
Finally, precede a conversion specifier of e, f, or g
with an l (lowercase ell) if the corresponding argument
is a pointer to double rather than a pointer to float,
or with an L if it is a pointer to long double.
If an h, l, or L appears with any other conversion
specifier, the behavior is undefined.
123.2 - Conversion Specifier
d Expects a decimal integer in the input whose format is
the same as expected for the subject sequence of the
strtol function with the value 10 for the base
argument. The corresponding argument must be a pointer
to int.
i Expects an integer whose type is determined by the
leading input characters. For example, a leading 0 is
equated to octal, a leading 0X is equated to
hexadecimal, and all other forms are equated to
decimal. The corresponding argument must be a pointer
to int.
o Expects an octal integer in the input (with or without
a leading 0). The corresponding argument must be a
pointer to int.
u Expects a decimal integer in the input whose format is
the same as expected for the subject sequence of the
strtoul function with the value 10 for the base
argument.
x Expects a hexadecimal integer in the input (with or
without a leading 0x). The corresponding argument must
be a pointer to unsigned int.
c Expects a single byte in the input. The corresponding
argument must be a pointer to char. If a field width
precedes the c conversion specifier, the number of
characters specified by the field width is read. In
this case, the corresponding argument must be a pointer
to an array of char.
C Expects a multibyte character in the input which is
converted into a wide character code. The
corresponding argument must be a pointer to type
wchar_t. If a field width precedes the C conversion
specifier, the number of characters specified by the
field width is read; in this case, the corresponding
argument must be a pointer to array of wchar_t.
s Expects a sequences of bytes in the input. The
corresponding argument must be a pointer to an array of
characters that is large enough to contain the sequence
plus a terminating null character, which is added
automatically. The input field is terminated by a
space, tab, or new-line character.
S Expects a sequence of multibyte characters in the
input, which are converted to wide-character codes.
The corresponding argument must be a pointer to an
array of wide characters (type wchar_t) that is large
enough to contain the sequence plus a terminating null
wide-character code which is added automatically. The
input field is terminated by a space, tab, or new-line
character.
e,f,g Expects a floating-point number in the input. The
corresponding argument must be a pointer to float. The
input format for floating-point numbers is:
[+|-]nnn[radix][ddd][{E|e}[+|-]nn]
The n's and d's are decimal digits (as many as
indicated by the field width minus the signs and the
letter E). The radix character is defined in the
current locale.
[...] Expects a nonempty sequence of characters that is not
delimited by a white-space character. The brackets
enclose a set of characters (the scanset) expected in
the input sequence. Any character in the input
sequence that does not match a character in the scanset
terminates the character sequence. The corresponding
argument must be a pointer to an array of characters.
All characters between the brackets comprise the
scanset, unless the first character after the left
bracket is a circumflex (^). In this case, the scanset
contains all characters other than those that appear
between the circumflex and the right bracket; that is,
any character that does appear between the circumflex
and the right bracket will terminate the input
character sequence.
If the conversion specifier begins with [] or [^], the
right-bracket character is in the scanset and the next
right-bracket character is the matching right bracket
that ends the specification; otherwise, the first right
bracket character ends the specification.
p An argument that is a pointer to void. The input value
is interpreted as a hexadecimal value.
n No input is consumed. The corresponding argument is a
pointer to an integer. The integer is assigned the
number of characters read from the input stream so far
by this call to the formatted input function.
Execution of a %n directive does not increment the
assignment count returned when the formatted input
function completes execution.
% Matches a single percent symbol. No conversion or
assignment takes place. The complete conversion
specification would be %%.
Positions the file to the specified byte offset in the file.
Syntax:
#include <stdio.h>
int fseek(FILE *file_pointer, long int offset, int direction);
Sets the file position indicator for the stream according to the
value of the object pointed to by pos.
Syntax:
#include <stdio.h>
int fsetpos (FILE *stream, const fpos_t *pos);
Accesses information about the file descriptor or the file
specification.
Syntax:
#include <stat.h>
int fstat(int file_descriptor, struct stat *buffer);
Flushes data all the way to the disk.
Syntax:
#include <unistd.h>
int fsync(int file_descriptor);
Returns the current byte offset to the specified file.
Syntax:
#include <stdio.h>
long int ftell(FILE *file_pointer);
Returns the time elasped since 00:00:00 January 1, 1970, in the
structure pointed at by timeptr.
Syntax:
#include <timeb.h>
int ftime(struct timeb *timeptr);
Truncates a file to a specified length.
Syntax:
#include <unistd.h>
int ftruncate (int filedes, off_t length);
Walks a file tree.
Syntax:
#include <ftw.h>
int ftw (const char *path,
int(*function)(cont char *,const struct stat *,int)
int depth);
Is used to wait for I/O on a specific file to complete.
Syntax:
#include <stdio.h>
int fwait(FILE *fp);
Determines and sets the orientation of a stream.
Syntax:
#include <wchar.h>
int fwide (FILE *stream, int mode);
Prints formatted output to a stream based on specified arguments.
Syntax:
#include <wchar.h>
int fwprintf (FILE *stream, const wchar_t *format, ...);
Writes a specified number of items to the file.
Syntax:
#include <stdio.h>
size_t fwrite(const void *pointer, size_t size_of_item,
size_t number_items, FILE *file_pointer);
Performs formatted input from a stream based on specified
arguments.
Syntax:
#include <wchar.h>
int fwscanf (FILE *stream, const wchar_t *format, ...);
Converts its value argument to a null-terminated string of ASCII
digits and returns the address of the string. The strings are
stored in a memory location created by the function.
Syntax:
#include <stdlib.h>
char *gcvt(double value, int ndigit, char *buf);
Returns characters from a specified file.
Syntax:
#include <stdio.h>
int getc(FILE *file_pointer);
Curses Screen Management function and macro that get a character
from the terminal screen and echo it on the specified window. The
getch macro echos the character on stdscr.
Syntax:
#include <curses.h>
char getch();
char wgetch(WINDOW *win);
Reads a single character from the standard input (stdin).
Syntax:
#include <stdio.h>
int getchar(void);
Gets current value of system-wide clock.
Syntax:
#include <timers.h>
int getclock (int clktyp, struct timespec *tp);
Returns a pointer to the file specification for the current working
directory.
Syntax:
#include <unistd.h>
char *getcwd (char *buffer, size_t size); (POSIX-1)
char *getcwd (char *buffer, unsigned int size,...); (Compaq C
Extension)
where the ... is an optional argument that can be either 1 or 0.
If you specify 1, getcwd returns the directory specification in
OpenVMS format. If you specify 0, getcwd returns the directory
specification (path name) in UNIX style format. If you do not
specify this argument, getcwd returns the file name according to
your current command-language interpreter.
Gets the total number of file descriptors that a process can have
open simultaneously.
Syntax:
#include <unistd.h>
int getdtablesize (void);
Returns, in OpenVMS terms, the group number from the user
identification code (UIC). For example, if the UIC is [313,031],
313 is the group number.
Syntax:
#include <unistd.h>
gid_t getegid(void);
Searches the environment array for the current process and returns
the value associated with the environment name.
Syntax:
#include <stdlib.h>
char *getenv(const char *name);
Returns, in OpenVMS terms, the member number from the user
identification code (UIC). For example, if the UIC is [313,031],
313 is the member number.
Syntax:
#include <unistd.h>
uid_t geteuid(void)
Returns, in OpenVMS terms, the group number from the user
identification code (UIC). For example, if the UIC is [313,031],
313 is the group number.
Syntax:
#include <unistd.h>
gid_t getgid(void);
Returns the value of interval timers.
Syntax:
#include <time.h>
#define ITIMER_REAL 0
#define ITIMER_VIRTUAL 1
#define ITIMER_PROF 2
int getitimer (int which, struct itimerval *value);
Gets login name.
Syntax:
#include <unistd.h>
char *getlogin (void);
Returns the file specification associated with a file descriptor.
Syntax:
#include <unixio.h>
char *getname(int file_descriptor, char *buffer,...);
where the ... is an optional argument that can be either 1 or 0.
If you specify 1, getname returns the directory specification in
OpenVMS format. If you specify 0, getname returns the directory
specification (path name) in UNIX style format. If you do not
specify this argument, getname returns the file name according to
your current command-language interpreter.
The getopt function is a command-line parser that can be used by
applications that follow Utility Syntax Guidelines 3,4,5,6,7,9, and
10 in Section 10.2 of the XBD specification. The remaining
guidelines are not addressed by getopt and are the responsibility
of the application.
Syntax:
#include <unistd.h> (X/Open, POSIX-2)
#include <stdio.h> (X/Open, POSIX-1)
int getopt(int argc, char * const argv[], const char
*optstring);
extern char *optarg;
extern int optind, opterr, optopt;
Gets the system page size.
Syntax:
#include <unistd.h>
int getpagesize (void);
Returns the process ID of the current process.
Syntax:
#include <unistd.h>
pid_t getpid(void);
Returns the parent process ID of the calling process.
Syntax:
#include <unistd.h>
pid_t getppid (void);
Accesses user name information in the user database.
Syntax:
#include <pwd.h>
struct passwd *getpwnam (const char name);
Accesses user ID information in the user database.
Syntax:
#include <pwd.h>
struct passwd *getpwuid (uid_t uid);
Reads a line from the standard input (stdin).
Syntax:
#include <stdio.h>
char *gets(char *string);
Curses Screen Management function and macro that get a string from
the terminal screen, store it in the variable str, and echo it on
the specified window. The getstr macro works on the stdscr window.
Syntax:
#include <curses.h>
int getstr(char *str);
int wgetstr(WINDOW *win, char *str);
Gets date and time. The tpz argument must be the NULL pointer.
Otherwise, the argument is ignored.
Syntax:
#include <time.h>
int gettimeofday (struct timeval *tp, void *tpz);
Returns, in OpenVMS terms, the member number from the user
identification code (UIC). For example, if the UIC is [313,031],
313 is the member number.
Syntax:
#include <unistd.h>
uid_t getuid(void);
Returns characters from a specified file.
Syntax:
#include <stdio.h>
int getw(FILE *file_pointer);
Reads the next character from a specified file, and converts it to
a wide-character code.
Syntax:
#include <wchar.h>
wint_t getwc (FILE *file_ptr);
Reads a single wide character from the standard input (stdin). The
getwchar function is identical to fgetwc(stdin).
Syntax:
#include <wchar.h>
wint_t getwchar (void);
Curses Screen Management function that puts the (y,x) coordinates
of the current cursor position on win in the variables y and x.
Syntax:
#include <curses.h>
getyx(WINDOW *win, int y, int x);
Converts the time (in seconds since the Epoch) pointed to by timer
into a broken-down time, expressed as Coordinated Universal Time
(UTC).
Note: The name of this function was originally defined to return
the time expressed as GMT (Greenwich Mean Time); its definition was
changed to reflect current technical standard terminology.
gmtime_r puts the result into a user-specified buffer.
gmtime puts the result into thread-specific static memory allocated
by the Compaq C RTL, which can be overwritten by subsequent calls
to gmtime; you must make a copy if you want to save it.
Syntax:
#include <time.h>
struct tm *gmtime (const time_t *timer);
struct tm *gmtime_r(const time_t *timer, struct tm *result);
[posix1]
Generates a specified software signal. Generating a signal causes
the action routine established by the signal, ssignal, or sigvec
function to be invoked.
Syntax:
#include <signal.h>
int gsignal(int sig [, int sigcode]);
Returns the square root of the sum of two squares of two arguments.
For example: sqrt(x*x + y*y).
Syntax:
#include <math.h>
double hypot(double x, double y);
Converts characters coded in one codeset into another codeset.
Characters in the buffer pointed to by inbuf are converted to
characters in another code set. The resulting characters are
stored in the buffer pointed to by outbuf. The conversion type is
specified by the conversion descriptor cd. This descriptor is
returned from a successful call to iconv_open.
If an invalid character is found in the input buffer, the
conversion stops after the last successful conversion. The
variable pointed to by inbytesleft is updated to reflect the number
of bytes in the input buffer that are not converted. The variable
pointed to by outbytesleft is updated to reflect the number of
bytes available in the output buffer.
Syntax:
#include <iconv.h>
size_t iconv (iconv_t cd, char **inbuf, size_t *inbytesleft,
char **outbuf,
size_t *outbytesleft);
Deallocates a specified conversion descriptor and the resources
allocated to it.
Syntax:
#include <iconv.h>
int iconv_close (iconv_t cd);
Allocates a conversion descriptor for a specified codeset
conversion.
Syntax:
#include <iconv.h>
iconv_t iconv_open (const char *tocode, const char *fromcode);
Curses Screen Management function and macro that return the
character at the current cursor position on the specified window
without making changes to the window. The inch macro acts on the
stdscr window.
Syntax:
#include <curses.h>
char inch();
char winch(WINDOW *win);
Search for a character in a string.
Syntax:
#include <strings.h>
char *index (const char *s, int c);
Curses Screen Management function that initializes the
terminal-type data and all screen functions. You must call initscr
before using any of the Curses functions or macros.
Syntax:
#include <curses.h>
void initscr(void);
Initializes, restarts, and changes random number generators.
Syntax:
#include <stdlib.h>
char *initstate (unsigned int seed, char *state, int size);
Curses Screen Management function and macro that insert the
character ch at the current cursor position in the specified
window. The insch macro acts on the stdscr window.
Syntax:
#include <curses.h>
int insch(char ch);
int winsch(WINDOW *win, char ch);
Curses Screen Management function and macro that insert a line
above the line containing the current cusor position. The insertln
macro acts on the stdscr window.
Syntax:
#include <curses.h>
int insertln();
int winsertln(WINDOW *win);
Curses Screen Management function and macro that insert a string at
the current cursor position on the specified window. The insstr
macro acts on the stdscr window.
Syntax:
#include <curses.h>
int insstr(char *str);
int winsstr(WINDOW *win, char *str);
Returns a nonzero integer if its argument is classed as alphabetic
or as a digit in the program's current locale. Otherwise, it
returns 0.
Syntax:
#include <ctype.h>
int isalnum(int character);
Returns a nonzero integer if its argument is classed as an
alphabetic character in the program's current locale. Otherwise,
it returns 0.
Syntax:
#include <ctype.h>
int isalpha(int character);
Returns 1 if the specified file descriptor is associated with a
pipe, and 0 if it is not.
Syntax:
#include <unixio.h>
int isapipe(int file_descriptor);
Returns a nonzero integer if its argument is any ASCII character.
Otherwise, it returns 0.
Syntax:
#include <ctype.h>
int isascii(int character);
Returns 1 if the specified file descriptor is associated with a
terminal, and 0 if it is not.
Syntax:
#include <unistd.h>
int isatty(int file_descriptor);
Returns a nonzero integer if its argument is classed as a control
character in the program's current locale. Otherwise, it returns
0.
Syntax:
#include <ctype.h>
int iscntrl(int character);
Returns a nonzero integer if its argument is classed as a digit in
the program's current locale. Otherwise, it returns 0.
Syntax:
#include <ctype.h>
int isdigit(int character);
Returns a nonzero integer if its argument is classed as a graphic
character in the program's current locale. Otherwise, it returns
0.
Syntax:
#include <ctype.h>
int isgraph(int character);
Returns a nonzero integer if its argument is classed as a lowercase
character in the program's current locale. Otherwise, it returns
0.
Syntax:
#include <ctype.h>
int islower(int character);
Returns a nonzero integer if its argument is classed as a printing
character in the program's current locale. Otherwise, it returns
0.
Syntax:
#include <ctype.h>
int isprint(int character);
Returns a nonzero integer if its argument is classed as a
punctuation character in the program's current locale. Otherwise,
it returns 0.
Syntax:
#include <ctype.h>
int ispunct(int character);
Returns a nonzero integer if its argument is classed as a space
character in the program's current locale. Otherwise, it returns
0.
Syntax:
#include <ctype.h>
int isspace(int character);
Returns a nonzero integer if its argument is classed as an
uppercase character in the program's current locale. Otherwise, it
returns 0.
Syntax:
#include <ctype.h>
int isupper(int character);
Returns a nonzero integer if its wide-character argument is classed
as alphabetic or as a digit in the program's current locale.
Otherwise, it returns 0.
Syntax:
#include <wchar.h>
int iswalnum (wint_t wc);
Returns a nonzero integer if its wide-character argument is classed
as an alphabetic character in the program's current locale.
Otherwise, it returns 0.
Syntax:
#include <wctype.h> (ISO C Standard)
#include <wchar.h> (XPG4 Standard)
int iswalpha (wint_t wc);
Returns a nonzero integer if its wide-character argument is classed
as a control character in the program's current locale. Otherwise,
it returns 0.
Syntax:
#include <wctype.h> (ISO C Standard)
#include <wchar.h> (XPG4 Standard)
int iswcntrl (wint_t wc);
Returns a nonzero integer if its wide-character argument has a
specified property. Otherwise, it returns 0. The specified
property (wc_prop) is set by calling the wctype routine.
Syntax:
#include <wctype.h> (ISO C Standard)
#include <wchar.h> (XPG4 Standard)
int iswctype (wint_t wc, wctype_t wc_prop);
Returns a nonzero integer if its wide-character argument is classed
as a digit in the program's current locale. Otherwise, it returns
0.
Syntax:
#include <wctype.h> (ISO C Standard)
#include <wchar.h> (XPG4 Standard)
int iswdigit (wint_t wc);
Returns a nonzero integer if its wide-character argument is classed
as a graphic character in the program's current locale. Otherwise,
it returns 0.
Syntax:
#include <wctype.h> (ISO C Standard)
#include <wchar.h> (XPG4 Standard)
int iswgraph (wint_t wc);
Returns a nonzero integer if its wide-character argument is classed
as a printing character in the program's current locale.
Otherwise, it returns 0.
Syntax:
#include <wctype.h> (ISO C Standard)
#include <wchar.h> (XPG4 Standard)
int iswprint (wint_t wc);
Returns a nonzero integer if its wide-character argument is classed
as a punctuation character in the program's current locale.
Otherwise, it returns 0.
Syntax:
#include <wctype.h> (ISO C Standard)
#include <wchar.h> (XPG4 Standard)
int iswpunct (wint_t wc);
Returns a nonzero integer if its wide-character argument is classed
as a space character in the program's current locale. Otherwise,
it returns 0.
Syntax:
#include <wctype.h> (ISO C Standard)
#include <wchar.h> (XPG4 Standard)
int iswspace (wint_t wc);
Returns a nonzero integer if its wide-character argument is classed
as an upppercase character in the program's current locale.
Otherwise, it returns 0.
Syntax:
#include <wctype.h> (ISO C Standard)
#include <wchar.h> (XPG4 Standard)
int iswupper (wint_t wc);
Returns a nonzero integer if its wide-character argument is a
hexadecimal digit (0 to 9, A to F, or a to f) in the program's
current locale. Otherwise, it returns 0.
Syntax:
#include <wctype.h> (ISO C Standard)
#include <wchar.h> (XPG4 Standard)
int iswxdigit (wint_t wc);
Returns a nonzero integer if its argument is a hexadecimal digit (0
to 9, A to F, or a to f) in the program's current locale.
Syntax:
#include <ctype.h>
int isxdigit(int character);
Generate uniformly distributed pseudorandom number sequences.
Returns 48-bit signed, long integers.
Syntax:
#include <stdlib.h>
long int jrand48 (unsigned short int xsubi[3]);
Sends a signal to a process specified by a process ID (PID). This
function does not support the same functionality supported by UNIX*
systems. This function is restricted to C and C++ programs that
include the main() function.
* UNIX is a trademark of The Open Group.
Syntax:
#include <signal.h>
int kill(int pid, int sig);
Returns the absolute value of an integer as a long int.
Syntax:
#include <stdlib.h>
long int labs(long int j);
Initializes a 48-bit uniformly distributed pseudorandom number
sequences.
Syntax:
#include <stdlib.h>
void lcong48 (unsigned short int param[7]);
Returns its first argument multiplied by 2 raised to the power of
its second argument.
Syntax:
#include <math.h>
double ldexp(double x, int e);
Returns the quotient and remainder after the division of its
arguments.
Syntax:
#include <stdlib.h>
ldiv_t ldiv(long int numer, long int denom);
Curses Screen Management macro that signals Curses to leave the
cursor at the current coordinates after an update to the window.
Syntax:
#include <curses.h>
leaveok(WINDOW *win, bool boolf);
Creates a new link (directory entry) for an existing file.
Syntax:
#include <unistd.h>
link(const char *path1, const char *path2);
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.
Syntax:
#include <locale.h>
struct lconv *localeconv(void);
212 - localtime, localtime_r
|
Converts a time (expressed as the number of seconds elapsed since
00:00:00, January 1, 1970) into hours, minutes, seconds, and so on.
This function is nonreentrant.
localtime_r puts the result into a user-specified tm structure.
localtime stores the result into thread-specific static memory
allocated by the Compaq C RTL, and which is overwritten by
subsequent calls to localtime; you must make a copy if you want to
save it.
Syntax:
#include <time.h>
struct tm *localtime(const time_t *timer);
struct tm *localtime_r(const time_t *timer, struct tm
*result); [posix1]
Returns the natural (base-e) logarithm of its argument.
Syntax:
#include <math.h>
double log(double x);
Returns the base-10 logarithm of its argument.
Syntax:
#include <math.h>
double log10(double x);
Provides a way to transfer control from a nested series of function
invocations back to a predefined point without returning normally;
that is, by not using a series of return statements. The longjmp
function restores the context of the environment buffer.
Syntax:
#include <setjmp.h>
void longjmp(jmp_buf env, int val);
Returns the full name of the terminal. The name parameter is a
character-string buffer with a minimum length of 64 characters, and
must be large enough to hold the name.
Syntax:
#include <curses.h>
void longname(char *termbuf, char *name);
Generates uniformly distributed pseudorandom number sequences.
Returns 48-bit signed long integers.
Syntax:
#include <stdlib.h>
long int lrand48 (void);
Positions a file to an arbitrary byte position and returns the new
position as an int.
Syntax:
#include <unistd.h>
off_t lseek(int file_descriptor, off_t offset, int direction);
Is used to wait for I/O on a specific file to complete.
Syntax:
#include <stdio.h>
int lwait(int fd);
Allocates an area of memory. This function is AST-reentrant.
This function allocates a contiguous area of memory whose size, in
bytes, is supplied as an argument. The space is not initialized.
Syntax:
#include <stdlib.h>
void *malloc(size_t size);
Note:
The malloc routines calls the system routine LIB$VM_MALLOC.
Because LIB$VM_MALLOC is designed as a general purpose routine
to allocate
memory, it is called upon in a wide array of scenarios to
allocate and reallocate blocks efficiently. The most common
usage
is the management of smaller blocks of memory, and the most
important
aspect of memory allocation under these circumstances is
efficiency.
LIB$VM_MALLOC makes use of its own free space to satisfy
requests, once the
heap storage is consumed by splitting large blocks and merging
adjacent blocks.
Memory can still become fragmented, leaving unused blocks.
Once heap storage
is consumed, LIB$VM_MALLOC manages its own free space and
merged blocks to
satisfy requests, but varying sizes of memory allocations can
cause blocks to
be left unused.
Because LIB$VM_MALLOC cannot be made to satisfy all situations
in the best
possible manner, you should perform your own memory management
if you have
special memory usage needs. This assures the best use of
memory for
your particular application.
The OpenVMS Programming Concepts Manual explains the several
memory
allocation routines that are available. They are grouped into
3
levels of hierarchy:
o At the highest level are the RTL Heap Management
Routines LIB$GET_VM and LIB$FREE_VM, which provide a
mechanism
for allocating and freeing blocks of memory of arbitrary
size. Also
at this level are the routines based on the concept of
zones, such as
LIB$CREATE_VM_ZONE, and so on.
o At the next level are the RTL Page Management
routines LIB$GET_VM_PAGE and LIB$FREE_VM_PAGE, which
allocate
a specified number of contiguous pages.
o At the lowest level are the Memory Management System
Services such as
$CRETVA and $EXPREG that provide extensive control over
address space
allocation. Note that at the this level, you must manage
the allocation
precisely.
Determines the number of bytes comprising a multibyte character.
Syntax:
#include <stdlib.h>
int mblen(const char *s, size_t n);
Converts a sequence of multibyte characters into a sequence of
corresponding wide-character codes.
Syntax:
#include <stdlib.h>
size_t mbstowcs(wchar_t *pwcs, const char *s, size_t n);
Converts a multibyte character to its wide-character equivalent.
Syntax:
#include <stdlib.h>
int mbtowc(wchar_t *pwc, const char *s, size_t n);
Returns the number of multibyte characters in a multibyte character
sequence.
Syntax:
#include <wchar.h>
size_t mbrlen (const char *s, size_t n, mbstate_t *ps);
Determines the number of bytes needed to complete the next
multibyte character, including shift sequences.
Syntax:
#include <wchar.h>
size_t mbrtowc (wchar_t *pwc,
const char *s,
size_t n,
mbstate_t *ps);
Determines an initial state conversion.
Syntax:
#include <wchar.h>
int mbsinit (const mbstate_t *ps);
Converts a multibyte character sequence to a corresponding wide
character sequence.
Syntax:
#include <wchar.h>
size_t mbsrtowcs (wchar_t *dst,
const char **src,
size_t len,
mbstate_t *ps);
Copies characters sequentially between strings in memory areas.
Syntax:
#include <string.h>
void *memccpy (void *destination_str, void *source_str, int
c, size_t n);
Locates the first occurrence of the specified byte within the
initial size bytes of a given object.
Syntax:
#include <string.h>
void *memchr (const void *s1, int c, size_t size);
Compares two objects, byte by byte. The compare operation starts
with the first byte in each object. It returns an integer less
than, equal to, or greater than 0, depending on whether the lexical
value of the first object is less than, equal to, or greater than
that of the second object.
Syntax:
#include <string.h>
int memcmp (const void *s1, const void *s2, size_t size);
Copies a specified number of bytes from one object to another.
Use memmove rather than memcpy if the area pointed to by the
destination string could overlap the area pointed to by the source
string; memmove safely handle copies between overlapping objects;
memcpy gives undefined behavior.
Syntax:
#include <string.h>
void *memcpy (void *destination_str, const void *source_str,
size_t size);
Copies a specified number of bytes from one object to another.
Use memmove rather than memcpy if the area pointed to by the
destination string could overlap the area pointed to by the source
string; memmove safely handle copies between overlapping objects;
memcpy gives undefined behavior.
Syntax:
#include <string.h>
void *memmove(void *destination_str, const void *source_str,
size_t size);
Sets a specified number of bytes in a given object to a given
value.
memset copies value (converted to an unsigned char) into each of
the first size characters of the object pointed to by s.
Syntax:
#include <string.h>
void *memset (void *s, int value, size_t size);
Creates a directory.
Syntax:
#include <stat.h>
int mkdir(const char *dir_spec, mode_t mode); (POSIX-1)
int mkdir(const char *dir_spec, mode_t mode,...); (Compaq C
Extension)
where the ... represents the following optional arguments. These
arguments have fixed position in the argument list, and cannot be
arbitrarily placed.
o unsigned int uic
o unsigned short max_versions
o unsigned short r_v_number
Constructs a unique filename.
Syntax:
#include <stdlib.h>
int mkstemp (char *template);
Creates a unique file name from a template that you supply.
Syntax:
#include <stdlib.h>
char *mktemp(char *template);
Converts the local time structure to a calendar time value.
Syntax:
#include <time.h>
time_t mktime(struct tm *timeptr);
Maps a file system object into virtual memory.
Syntax:
#include <types.h>
#include <mman.h>
void mmap (void *addr,
size_t len,
int prot,
int flags,
int filedes,
off_t off); [xopen/posix-1]
size_t len,
int prot,
int flags,
int filedes,
off_t off...); [Compaq C extension]
Returns the positive fractional part of its first argument and
assigns the integer part, expressed as an object of type double, to
the object whose address is specified by the second argument.
Syntax:
#include <math.h>
double modf(double value, double *iptr);
Curses Screen Management function and macro that change the current
cursor position on the specified window to the coordinates (y,x).
The move macro acts on the stdscr window.
Syntax:
#include <curses.h>
int move(int y, int x);
int wmove(WINDOW *win, int y, int x);
Modifies access protections of memory mapping.
Syntax:
#include <mman.h>
int mprotect (void *addr, size_t len, int prot);
Generate uniformly distributed pseudorandom number sequences.
Returns 48-bit signed long integers.
Syntax:
#include <stdlib.h>
long int mrand48 (void);
Synchronizes a mapped file.
Syntax:
#include <mman.h>
int msync (void *addr, size_t len, int flags);
Unmaps a mapped region.
Syntax:
#include <mman.h>
int munmap (void *addr,size_t len);
Curses Screen Management macros that move the cursor to coordinates
(y,x) and add the character ch to the specified window. The
mvaddch macro acts on the stdscr window.
Syntax:
#include <curses.h>
int mvaddch(int y, int x, char ch);
int mvwaddch(WINDOW *win, int y, int x, char ch);
Curses Screen Management macros that move the cursor to coordinates
(y,x) and add the specified string, to which str points, to the
specified window. The mvaddstr macro acts on the stdscr window.
Syntax:
#include <curses.h>
int mvaddstr(int y, int x, char *str);
int mvwaddstr(WINDOW *win, int y, int x, char *str);
Curses Screen Management macro that moves the terminal's cursor
from (lasty,lastx) to (newy,newx).
Syntax:
#include <curses.h>
int mvcur(int lasty, int lastx, int newy, int newx);
Curses Screen Management macros that move the cursor to coordinates
(y,x) and delete the character on the specified window. The
mvdelch macro acts on the stdscr window.
Syntax:
#include <curses.h>
int mvdelch(int y, int x);
int mvwdelch(WINDOW *win, int y, int x);
Curses Screen Management macros that move the cursor to coordinates
(y,x), get a character from the terminal screen, and echo it on the
specified window. The mvgetch macro works on the stdscr window.
Syntax:
#include <curses.h>
int mvgetch(int y, int x);
int mvwgetch(WINDOW *win, int y, int x);
Curses Screen Management macros that move the cursor to coordinates
(y,x), get a string from the terminal screen, and echo it on the
specified window. The mvgetstr macro acts on the stdscr window.
Syntax:
#include <curses.h>
int mvgetstr(int y, int x, char *str);
int mvwgetstr(WINDOW *win, int y, int x, char *str);
Curses Screen Management macros that move the cursor to coordinates
(y,x) and return the character on the specified window without
making changes to the window. The mvinch macro acts on the stdscr
window.
Syntax:
#include <curses.h>
int mvinch(int y, int x);
int mvwinch(WINDOW *win, int y, int x);
Curses Screen Management macros that move the cursor to coordinates
(y,x) and insert the character ch in the specified window. The
mvinsch macro acts on the stdscr window.
Syntax:
#include <curses.h>
int mvinsch(int y, int x, char ch);
int mvwinsch(WINDOW *win, int y, int x, char ch);
Curses Screen Management macros that move the cursor to coordinates
(y,x) and insert a string on the specified window. The mvinsstr
macro acts on the stdscr window.
Syntax:
#include <curses.h>
int mvinsstr(int y, int x, char *str);
int mvwinsstr(WINDOW *win, int y, int x, char *str);
Curses Screen Management macro that moves the starting position of
the window to the specified (y,x) coordinates.
Syntax:
#include <curses.h>
int wvwin(WINDOW *win, int y, int x);
Curses Screen Management routine that creates a new window with
numlines lines and numcols columns starting at the coordinates
(begin_y, begin_x) on the terminal screen.
Syntax:
#include <curses.h>
WINDOW *newwin(int numlines, int numcols, int begin_y,
int begin_x);
Increments or decrements the process priority relative to the
process current priority by the amount of the argument. A negative
argument increments the priority; a positive argument decrements
it. Issuing nice(0) restores the base priority. The resulting
priority cannot be less than 1, or greater than the process's base
priority. This function is nonreentrant.
Syntax:
#include <unistd.h>
nice(int increment);
This function and macro are provided for UNIX* software compability
and have no OpenVMS function.
----------
* UNIX is a trademark of The Open Group.
Returns a pointer to a string that contains information obtained
from the program's current locale.
Syntax:
#include <langinfo.h>
char *nl_langinfo (nl_item item);
Generate uniformly distributed pseudorandom number sequences.
Returns 48-bit signed long integers.
Syntax:
#include <stdlib.h>
long int nrand48 (unsigned short int xsub[3]);
Opens a file for reading, writing, or editing. It positions the
file at its beginning (byte 0).
Syntax:
#include <fcntl.h>
int open(const char *file_spec, int flags, mode_t mode); (ANSI
C)
int open(const char *file_spec, int flags,...); (CEC C
Extension)
where the ... represents optional file attribute arguments. The
file attribute arguments are the same as those used in the creat
function.
Opens a specified directory.
Syntax:
#include <dirent.h>
DIR *opendir (const char *dir_name);
Curses Screen Management routine that superimposes win1 on win2.
The function writes the contents of win1 that will fit onto win2
beginning at the starting coordinates of both windows. Blanks on
win1 leave the contents of the corresponding space on win2
unaltered. The overlay function copies as much of the window's box
as possible.
Syntax:
#include <curses.h>
int overlay(WINDOW *win1, WINDOW *win2);
Curses Screen Management routine that destructively overwrites the
contents of win1 on win2.
Syntax:
#include <curses.h>
int overwrite(WINDOW *win1, WINDOW *win2);
Suspends the calling process until delivery of a signal whose
action is either to execute a signal-catching function or to
terminate the process.
Syntax:
#include <unistd.h>
int pause(void)
Retrieves file implementation characteristics.
Syntax:
#include <unistd.h>
long int pathconf (const char *path, int name);
Closes a pipe to a process.
Syntax:
#include <stdio.h>
int pclose (FILE *stream);
Writes a short message to stderr describing the last error
encountered during a call to the Compaq C RTL from a C program.
Syntax:
#include <stdio.h>
void perror(const char *string);
Creates a temporary mailbox. You must use a mailbox to read and
write data between the parent and child. The channels through
which the processes communicate are called a pipe.
Syntax:
#include <unistd.h>
int pipe(int file_descriptor[2]); (POSIX-1)
int pipe(int file_descriptor[2],...); (Compaq C Extension)
where:
file_descriptor[2] - is an array of file descriptors. A pipe is
implemented as an array of file descriptors associated with a
mailbox. These mailbox descriptors are special in that these are
the only file descriptors which, when passed to the isapipe
function, will return 1. Element 0 of the file_descriptor array
contains the descriptor for reading; element 1 contains the
descriptor for writing.
.. represents two optional arguments:
flags - If either the O_NDELAY or O_NONBLOCK bit is set, the I/O
operations to the mailbox through the specified file descriptors
will terminate immediately, rather than waiting for another
process.
If, for example, the O_NDELAY bit is set and the child issues a
read request to the mailbox before the parent has put any data into
it, the read terminates immediately with zero status. If neither
the O_NDELAY nor O_NONBLOCK bit is set, the child will be waiting
on the read until the parent writes any data into the mailbox.
This is the default behavior if no flag argument is specified.
The values of O_NDELAY and O_NONBLOCK are defined in the <fcntl.h>
header file. Any other bits in the flag argument are ignored. You
must specify this argument if the second optional, positional
argument bufsize is specified. If the flag argument is needed only
to allow specification of the bufsize argument, specify flag as
zero.
bufsize -- specifies the size of the mailbox, in bytes. If you do
not specify this argument, a mailbox is created with a default size
of 512 bytes.
Initiates a pipe to a process.
Syntax:
#include <stdio.h>
FILE *popen (const char *command, const char *type);
Returns the first argument raised to the power of the second
argument.
Syntax:
#include <math.h>
double pow(double base, double exp);
Performs formatted output to the standard output (stdout).
Syntax:
#include <stdio.h>
int printf(const char *format_string,...);
where the ... represents optional expressions whose resultant
types correspond to conversion specifications given in the format
specification. If no conversion specifications are given, you may
omit the output sources. Otherwise, the function call must have
exactly as many output sources as there are conversion
specifications, and the conversion specifications must match the
types of the output sources. Conversion specifications are matched
to output sources in left-to-right order.
The format string for the output of information can contain two
kinds of items:
o Ordinary characters, which are copied to the output.
o Conversion specifications, each of which causes the conversion
of a corresponding output source to a character string in a
particular format. Conversion specifications are matched to
output sources in left-to-right order.
A conversion specification consists of a % (or a %n$), followed by
one or more optional characters, and concluding with a conversion
specifier.
271.1 - Optional character
flags You can use the following flag characters, alone or in
any combined order, to modify the conversion
specification:
' Requests that a numeric conversion is
formatted with the thousands separator
character. Only the numbers to the left of
the radix character are formatted with the
separator character. The character used as
a separator and the positioning of the
separators are defined in the program's
current locale.
-(hyphen) Left-justifies the converted output source
in its field.
+ Requests that an explicit sign be present on
a signed conversion. If this flag is not
specified, the result of a signed conversion
begins with a sign only when a negative
value is converted.
space Prefixes a space to the result of a signed
conversion, if the first character of the
conversion is not a sign, or if the
conversion results in no characters. If you
specify both the space and the + flag, the
space flag is ignored.
# Requests an alternate form conversion.
Depending on the conversion specified,
different actions will occur. For the o
(octal) conversion, the precision is
increased to force the first digit to be a
0. For the x (or X) conversion, a nonzero
result is prefixed with 0x (or 0X). For e,
E, f, g, and G conversions, the result
contains a decimal point even at the end of
an integer value. For g and G conversions,
trailing zeros are not trimmed. For other
conversions, the effect of # is undefined.
0 Uses zeros rather than spaces to pad the
field width for d, i, o, u, x, X, e, E, f,
g, and G conversions. If both the 0 and the
- flags are specified, then the 0 flag is
ignored. For d, i, o, u, x, and X
conversions, if a precision is specified,
the 0 flag is ignored. For other
conversions, the behavior of the 0 flag is
undefined.
field width The minimum field width can be designated by a decimal
integer constant, or by an output source. To specify
an output source, use an asterisk (*) or the sequence
*n$, where n refers to the nth output source listed
after the format specification. If the converted
output source is wider than the minimum field, write
it out. If the converted output source is narrower
than the minimum width, pad it to make up the field
width. Pad with spaces, by default. Pad with zeros
if the 0 flag is specified; this does not mean that
the width is an octal number. Padding is on the left
by default, and on the right if a minus sign is
specified.
If an asterisk is used for the field width, the
corresponding width is given in the output source.
period (.) Separates the field width from the precision.
precision The precision defines the minimum number of digits to
appear for d, i, o, u, x, and X conversions; the
number of digits to appear after the decimal-point
character for e, E, and f conversions; the maximum
number of significant digits for g and G conversions;
or the maximum number of characters to be written from
a string in an s or S conversion. If a precision
appears with any other conversion specifier, the
behavior is undefined.
Precision can be designated by a decimal integer
constant, or by an output source. To specify an
output source, use an asterisk (*) or the sequence
*n$, where n refers to the nth output source listed
after the format specification.
If only the period is specified, the precision is
taken as 0.
h, l, or L An h specifies that a following d, i, o, u, x, or X
conversion specifier applies to a short int or
unsigned short int argument; an h can also specify
that a following n conversion specifier applies to a
pointer to a short int argument.
An l (lowercase ell) specifies that a following d, i,
o, u, x, or X conversion specifier applies to a long
int or unsigned long int argument; an l can also
specify that a following n conversion specifier
applies to a pointer to a long int argument.
An L specifies that a following e, E, f, g, or G
conversion specifier applies to a long double
argument.
If an h, l, or L appears with any other conversion
specifier, the behavior is undefined.
On Compaq C for OpenVMS VAX and Alpha Systems, int
values are equivalent to long values.
271.2 - Conversion Specifier
d, i Converts an int argument to signed decimal format.
o Converts an unsigned int argument to unsigned octal
format.
u Converts an unsigned int argument to unsigned decimal
format (giving a number in the range 0 to 4,294,967,295).
x, X Converts an unsigned int argument to unsigned hexadecimal
format (with or without a leading 0x). The letters
'abcdef' are used for the x conversion; the letters
'ABCDEF' are used for the X conversion.
f Converts a float or double argument to the format
[-]mmm.nnnnnn. The number of n's is equal to the
precision specification. If no precision is specified,
the default is 6.
If the precision is 0 and the # flag is specified, the
decimal point appears but no n's appear. If the precision
is 0 and the # flag is not specified, the decimal point
also does not appear. If a decimal point appears, at
least one digit appears before it. The value is rounded
to the appropriate number of digits.
e, E Converts a float or double argument to the format
[-]m.nnnnnnE[+|-]xx. The number of n's is specified by
the precision. If no precision is specified, the default
is 6. If the precision is explicitly 0 and the # flag is
specified, the decimal point appears but no n's appear.
If the precision is explicitly 0 and the # flag is not
specified, the decimal point also does not appear. An 'e'
is printed for e conversion; an 'E' is printed for E
conversion. The exponent always contains at least two
digits. If the value is 0, the exponent is 0.
g, G Converts a float or double argument to format f or e (or E
if the G conversion specifier is used), with the precision
specifying the number of significant digits. If the
precision is 0, it is taken as 1.
c Converts an int argument to an unsigned char, and writes
the resulting character (null characters are ignored).
C Converts a wchar_t argument to an array of bytes
representing the character, and writes the resulting
character. If the field width is specified and the
resulting character occupies fewer bytes than the field
width, it will be padded to the given width with space
characters. If the precision is specified, the behavior
is undefined.
s Requires an argument that is a pointer to an array of
characters of type char. The argument is used to write
characters until a null character is encountered or until
the number of characters indicated by the precision
specification is exhausted. If the precision
specification is 0 or omitted, all characters up to a null
are output.
S Converts an array of wide-character codes to multibyte
characters, and writes the multibyte characters. Requires
an argument that is a pointer to an array of wide
characters of type wchar_t. Characters are written until
a null wide character is encountered or until the number
of bytes indicated by the precision specification is
exhausted. If the precision specification is omitted or
is greater than the size of the array of converted bytes,
the array of wide characters must be terminated by a null
wide character.
p Requires an argument that is a pointer to void. The value
of the pointer is output as a hexadecimal character.
n Requires an argument that is a pointer to an integer. The
integer is assigned the number of characters written to
the output stream so far by this call to the formatted
output function. No argument is converted.
% Writes out the percent symbol. No conversion is
performed. The complete conversion specification would be
%%.
Curses Screen Management function and macro that perform a printf
in the specified window starting at the current position of the
cursor. The printw macro acts on the stdscr window.
Syntax:
#include <curses.h>
printw(char *format_string,...);
int wprintw(WINDOW *win, char *format_string,...);
where the ... represents optional expressions whose resultant
types correspond to conversion specifications given in the format
specification. If no conversion specifications are given, you may
omit the output sources. Otherwise, the function call must have
exactly as many output sources as there are conversion
specifications, and the conversion specifications must match the
types of the output sources. Conversion specifications are matched
to output sources in left-to-right order.
The format string for the output of information can contain two
kinds of items:
o Ordinary characters, which are copied to the output.
o Conversion specifications, each of which causes the conversion
of a corresponding output source to a character string in a
particular format. Conversion specifications are matched to
output sources in left-to-right order.
A conversion specification consists of a % (or a %n$), followed by
one or more optional characters, and concluding with a conversion
specifier.
272.1 - Optional character
flags You can use the following flag characters, alone or in
any combined order, to modify the conversion
specification:
' Requests that a numeric conversion is
formatted with the thousands separator
character. Only the numbers to the left of
the radix character are formatted with the
separator character. The character used as
a separator and the positioning of the
separators are defined in the program's
current locale.
-(hyphen) Left-justifies the converted output source
in its field.
+ Requests that an explicit sign be present on
a signed conversion. If this flag is not
specified, the result of a signed conversion
begins with a sign only when a negative
value is converted.
space Prefixes a space to the result of a signed
conversion, if the first character of the
conversion is not a sign, or if the
conversion results in no characters. If you
specify both the space and the + flag, the
space flag is ignored.
# Requests an alternate form conversion.
Depending on the conversion specified,
different actions will occur. For the o
(octal) conversion, the precision is
increased to force the first digit to be a
0. For the x (or X) conversion, a nonzero
result is prefixed with 0x (or 0X). For e,
E, f, g, and G conversions, the result
contains a decimal point even at the end of
an integer value. For g and G conversions,
trailing zeros are not trimmed. For other
conversions, the effect of # is undefined.
0 Uses zeros rather than spaces to pad the
field width for d, i, o, u, x, X, e, E, f,
g, and G conversions. If both the 0 and the
- flags are specified, then the 0 flag is
ignored. For d, i, o, u, x, and X
conversions, if a precision is specified,
the 0 flag is ignored. For other
conversions, the behavior of the 0 flag is
undefined.
field width The minimum field width can be designated by a decimal
integer constant, or by an output source. To specify
an output source, use an asterisk (*) or the sequence
*n$, where n refers to the nth output source listed
after the format specification. If the converted
output source is wider than the minimum field, write
it out. If the converted output source is narrower
than the minimum width, pad it to make up the field
width. Pad with spaces, by default. Pad with zeros
if the 0 flag is specified; this does not mean that
the width is an octal number. Padding is on the left
by default, and on the right if a minus sign is
specified.
If an asterisk is used for the field width, the
corresponding width is given in the output source.
period (.) Separates the field width from the precision.
precision The precision defines the minimum number of digits to
appear for d, i, o, u, x, and X conversions; the
number of digits to appear after the decimal-point
character for e, E, and f conversions; the maximum
number of significant digits for g and G conversions;
or the maximum number of characters to be written from
a string in an s or S conversion. If a precision
appears with any other conversion specifier, the
behavior is undefined.
Precision can be designated by a decimal integer
constant, or by an output source. To specify an
output source, use an asterisk (*) or the sequence
*n$, where n refers to the nth output source listed
after the format specification.
If only the period is specified, the precision is
taken as 0.
h, l, or L An h specifies that a following d, i, o, u, x, or X
conversion specifier applies to a short int or
unsigned short int argument; an h can also specify
that a following n conversion specifier applies to a
pointer to a short int argument.
An l (lowercase ell) specifies that a following d, i,
o, u, x, or X conversion specifier applies to a long
int or unsigned long int argument; an l can also
specify that a following n conversion specifier
applies to a pointer to a long int argument.
An L specifies that a following e, E, f, g, or G
conversion specifier applies to a long double
argument.
If an h, l, or L appears with any other conversion
specifier, the behavior is undefined.
On Compaq C for OpenVMS VAX and Alpha Systems, int
values are equivalent to long values.
272.2 - Conversion Specifier
d, i Converts an int argument to signed decimal format.
o Converts an unsigned int argument to unsigned octal
format.
u Converts an unsigned int argument to unsigned decimal
format (giving a number in the range 0 to 4,294,967,295).
x, X Converts an unsigned int argument to unsigned hexadecimal
format (with or without a leading 0x). The letters
'abcdef' are used for the x conversion; the letters
'ABCDEF' are used for the X conversion.
f Converts a float or double argument to the format
[-]mmm.nnnnnn. The number of n's is equal to the
precision specification. If no precision is specified,
the default is 6.
If the precision is 0 and the # flag is specified, the
decimal point appears but no n's appear. If the precision
is 0 and the # flag is not specified, the decimal point
also does not appear. If a decimal point appears, at
least one digit appears before it. The value is rounded
to the appropriate number of digits.
e, E Converts a float or double argument to the format
[-]m.nnnnnnE[+|-]xx. The number of n's is specified by
the precision. If no precision is specified, the default
is 6. If the precision is explicitly 0 and the # flag is
specified, the decimal point appears but no n's appear.
If the precision is explicitly 0 and the # flag is not
specified, the decimal point also does not appear. An 'e'
is printed for e conversion; an 'E' is printed for E
conversion. The exponent always contains at least two
digits. If the value is 0, the exponent is 0.
g, G Converts a float or double argument to format f or e (or E
if the G conversion specifier is used), with the precision
specifying the number of significant digits. If the
precision is 0, it is taken as 1.
c Converts an int argument to an unsigned char, and writes
the resulting character (null characters are ignored).
C Converts a wchar_t argument to an array of bytes
representing the character, and writes the resulting
character. If the field width is specified and the
resulting character occupies fewer bytes than the field
width, it will be padded to the given width with space
characters. If the precision is specified, the behavior
is undefined.
s Requires an argument that is a pointer to an array of
characters of type char. The argument is used to write
characters until a null character is encountered or until
the number of characters indicated by the precision
specification is exhausted. If the precision
specification is 0 or omitted, all characters up to a null
are output.
S Converts an array of wide-character codes to multibyte
characters, and writes the multibyte characters. Requires
an argument that is a pointer to an array of wide
characters of type wchar_t. Characters are written until
a null wide character is encountered or until the number
of bytes indicated by the precision specification is
exhausted. If the precision specification is omitted or
is greater than the size of the array of converted bytes,
the array of wide characters must be terminated by a null
wide character.
p Requires an argument that is a pointer to void. The value
of the pointer is output as a hexadecimal character.
n Requires an argument that is a pointer to an integer. The
integer is assigned the number of characters written to
the output stream so far by this call to the formatted
output function. No argument is converted.
% Writes out the percent symbol. No conversion is
performed. The complete conversion specification would be
%%.
Writes characters to a specified file.
Syntax:
#include <stdio.h>
int putc(int character, FILE *file_pointer);
Writes a single character to the standard output (stdout) and
returns the character.
Syntax:
#include <stdio.h>
int putchar(int character);
Set an environmental variable.
Syntax:
#include <stdlib.h>
int putenv (const char *string);
Writes a character string to the standard output (stdout) followed
by a new-line.
Syntax:
#include <stdio.h>
int puts(const char *string);
Writes characters to a specified file.
Syntax:
#include <stdio.h>
int putw(int integer, FILE *file_pointer);
Converts a wide character to its corresponding multibyte value, and
writes the result to a specified file.
Syntax:
#include <wchar.h>
wint_t putwc(wint_t wc FILE *file_pointer);
Writes a wide character to the standard output (stdout) and returns
the character.
Syntax:
#include <wchar.h>
wint_t putwchar(wint_t wc);
Sorts an array of objects in place. It implements the quick-sort
algorithm.
Syntax:
#include <stdlib.h>
void qsort (void *base, size_t nmemb, size_t size,
int (*compar) (const void *, const void *));
Generates a specified software signal. Generating a signal causes
the action routine established by the signal, ssignal, or sigvec
function to be invoked.
Syntax:
#include <signal.h>
int raise(int sig); (ANSI C)
int raise(int sig[, int sigcode]); (Compaq C Extension)
Returns pseudorandom numbers in the range 0 to (2**31-1).
Syntax:
#include <math.h>
int rand(void);
Generates pseudorandom numbers in a more random sequence.
Syntax:
#include <stdlib.h>
long int random (void);
Curses Screen Management macros that set and unset the terminal to
and from raw mode. The raw function performs the same task as the
crmode macro except that raw does not imply nonl. These macros
only work with [w]getch and [w]getstr.
Syntax:
#include <curses.h>
raw()
noraw()
Reads bytes from a file and places them in a buffer.
Syntax:
#include <unistd.h>
ssize_t read(int file_descriptor, void *buffer, size_t
nbytes); (POSIX-1)
int read(int file_descriptor, void *buffer, int nbytes);
(Compatibility)
Finds entries in a directory.
Syntax:
#include <dirent.h>
struct dirent *readdir (DIR *dir_pointer);
Changes the size of the area pointed to by the first argument to
the number of bytes given by the second argument. This function is
AST-reentrant.
Syntax:
#include <stdlib.h>
void *realloc(void *pointer, size_t size);
Curses Screen Management function and macro that repaint the
specified window on the terminal screen. The refresh macro acts on
the stdscr window.
Syntax:
#include <curses.h>
int refresh();
int wrefresh(WINDOW *win);
Deletes a file.
Syntax:
#include <stdio.h>
int remove (const char *file-spec);
Gives a new name to an existing file.
Syntax:
#include <stdio.h>
int rename (const char *old_file_spec,
const char *new_file_spec);
Sets the file to its beginning.
Syntax:
#include <stdio.h>
void rewind(FILE *file_pointer); (POSIX-1)
int rewind(FILE *file_pointer); (Compaq C Extension)
Resets the position of the specified directory stream to the
beginning.
Syntax:
#include <dirent.h>
void rewinddir (DIR *dir_pointer);
Searches for character in string.
Syntax:
#include <strings.h>
char *rindex (const char *s, int c);
Removes a directory file.
Syntax:
#include <unistd.h>
int rmdir (const char *path);
Determines the lowest virtual address that is not used with the
program.
Syntax:
#include <unistd.h>
void *sbrk(long int incr);
Performs formatted input from the standard input (stdin).
Syntax:
#include <stdio.h>
int scanf(const char *format_string,...);
where the ... represents optional expressions that are pointers to
objects whose resultant types correspond to conversion
specifications given in the format_string. If no conversion
specifications are given, you may omit these input pointers.
Otherwise, the function call must have at least as many input
pointers as there are conversion specifications, and the conversion
specifications must match the types of the input pointers.
Conversion specifications are matched to input sources in
left-to-right order. Excess input pointers, if any, are ignored.
The format string for the input of information can include three
kinds of items:
o White-space characters (spaces, tabs, and new-line characters),
which match optional white-space characters in the input field.
o Ordinary characters (not %), which must match the next
nonwhite-space character in the input.
o Conversion specifications, which govern the conversion of the
characters in an input field and their assignment to an object
indicated by a corresponding input pointer.
A conversion specification consists of the following characters, in
the order listed:
o A percent character (%) or the sequence %n$ (where n is an
integer).
The sequence %n$ denotes that the conversion is applied to
the nth input pointer listed, where n is a decimal integer
between [1, NL_ARGMAX] (see the <limits.h> header file).
For example, a conversion specification beginning %5$ means
that the conversion will be applied to the 5th input
pointer listed after the format specification. The
sequence %$ is invalid. If the conversion specification
does not begin with the sequence %n$ the conversion
specification is matched to its input pointer in
left-to-right order. You should only use one type of
conversion specification (% or %n$) in a format
specification.
o One or more optional characters
o A conversion specifier.
296.1 - Optional character
* Assignment-suppressing character
field width Nonzero decimal integer that specifies the maximum
field width.
h, l, or L Precede a conversion specifier of d, i, or n with an h
if the corresponding argument is a pointer to short int
rather than a pointer to int, or with an l (lowercase
ell) if it is a pointer to long int.
Similarly, precede a conversion specifier of o, u, or x
with an h if the corresponding argument is a pointer to
unsigned short int rather than a pointer to unsigned
int, or with an l (lowercase ell) if it is a pointer to
unsigned long int.
Finally, precede a conversion specifier of e, f, or g
with an l (lowercase ell) if the corresponding argument
is a pointer to double rather than a pointer to float,
or with an L if it is a pointer to long double.
If an h, l, or L appears with any other conversion
specifier, the behavior is undefined.
296.2 - Conversion Specifier
d Expects a decimal integer in the input whose format is
the same as expected for the subject sequence of the
strtol function with the value 10 for the base
argument. The corresponding argument must be a pointer
to int.
i Expects an integer whose type is determined by the
leading input characters. For example, a leading 0 is
equated to octal, a leading 0X is equated to
hexadecimal, and all other forms are equated to
decimal. The corresponding argument must be a pointer
to int.
o Expects an octal integer in the input (with or without
a leading 0). The corresponding argument must be a
pointer to int.
u Expects a decimal integer in the input whose format is
the same as expected for the subject sequence of the
strtoul function with the value 10 for the base
argument.
x Expects a hexadecimal integer in the input (with or
without a leading 0x). The corresponding argument must
be a pointer to unsigned int.
c Expects a single byte in the input. The corresponding
argument must be a pointer to char. If a field width
precedes the c conversion specifier, the number of
characters specified by the field width is read. In
this case, the corresponding argument must be a pointer
to an array of char.
C Expects a multibyte character in the input which is
converted into a wide character code. The
corresponding argument must be a pointer to type
wchar_t. If a field width precedes the C conversion
specifier, the number of characters specified by the
field width is read; in this case, the corresponding
argument must be a pointer to array of wchar_t.
s Expects a sequences of bytes in the input. The
corresponding argument must be a pointer to an array of
characters that is large enough to contain the sequence
plus a terminating null character, which is added
automatically. The input field is terminated by a
space, tab, or new-line character.
S Expects a sequence of multibyte characters in the
input, which are converted to wide-character codes.
The corresponding argument must be a pointer to an
array of wide characters (type wchar_t) that is large
enough to contain the sequence plus a terminating null
wide-character code which is added automatically. The
input field is terminated by a space, tab, or new-line
character.
e,f,g Expects a floating-point number in the input. The
corresponding argument must be a pointer to float. The
input format for floating-point numbers is:
[+|-]nnn[radix][ddd][{E|e}[+|-]nn]
The n's and d's are decimal digits (as many as
indicated by the field width minus the signs and the
letter E). The radix character is defined in the
current locale.
[...] Expects a nonempty sequence of characters that is not
delimited by a white-space character. The brackets
enclose a set of characters (the scanset) expected in
the input sequence. Any character in the input
sequence that does not match a character in the scanset
terminates the character sequence. The corresponding
argument must be a pointer to an array of characters.
All characters between the brackets comprise the
scanset, unless the first character after the left
bracket is a circumflex (^). In this case, the scanset
contains all characters other than those that appear
between the circumflex and the right bracket; that is,
any character that does appear between the circumflex
and the right bracket will terminate the input
character sequence.
If the conversion specifier begins with [] or [^], the
right-bracket character is in the scanset and the next
right-bracket character is the matching right bracket
that ends the specification; otherwise, the first right
bracket character ends the specification.
p An argument that is a pointer to void. The input value
is interpreted as a hexadecimal value.
n No input is consumed. The corresponding argument is a
pointer to an integer. The integer is assigned the
number of characters read from the input stream so far
by this call to the formatted input function.
Execution of a %n directive does not increment the
assignment count returned when the formatted input
function completes execution.
% Matches a single percent symbol. No conversion or
assignment takes place. The complete conversion
specification would be %%.
Curses Screen Management function and macro that perform a scanf on
the window. The scanw macro acts on the stdscr window.
Syntax:
#include <curses.h>
int scanw(char *format_string,...);
int wscanw(WINDOW *win, char *format_string,...);
where the ... represents optional expressions that are pointers to
objects whose resultant types correspond to conversion
specifications given in the format specification. If no conversion
specifications are given, you may omit these input pointers.
Otherwise, the function call must have at least as many input
pointers as there are conversion specifications, and the conversion
specifications must match the types of the input pointers.
Conversion specifications are matched to input sources in
left-to-right order. Excess input pointers, if any, are ignored.
The format string for the input of information can include three
kinds of items:
o White-space characters (spaces, tabs, and new-line characters),
which match optional white-space characters in the input field.
o Ordinary characters (not %), which must match the next
nonwhite-space character in the input.
o Conversion specifications, which govern the conversion of the
characters in an input field and their assignment to an object
indicated by a corresponding input pointer.
Each input pointer is an address expression indicating an object
whose type matches that of a corresponding conversion specification.
Conversion specifications form part of the format string. The
indicated object is the target that receives the input value. There
must be as many input pointers as there are conversion
specifications, and the addressed objects must match the types of
the conversion specifications.
A conversion specification consists of the following characters, in
the order listed:
o A percent character (%) or the sequence %n$ (where n is an
integer).
The sequence %n$ denotes that the conversion is applied to
the nth input pointer listed, where n is a decimal integer
between [1, NL_ARGMAX] (see the <limits.h> header file).
For example, a conversion specification beginning %5$ means
that the conversion will be applied to the 5th input
pointer listed after the format specification. The
sequence %$ is invalid. If the conversion specification
does not begin with the sequence %n$ the conversion
specification is matched to its input pointer in
left-to-right order. You should only use one type of
conversion specification (% or %n$) in a format
specification.
o One or more optional characters
o A conversion specifier.
297.1 - Optional character
* Assignment-suppressing character
field width Nonzero decimal integer that specifies the maximum
field width.
h, l, or L Precede a conversion specifier of d, i, or n with an h
if the corresponding argument is a pointer to short int
rather than a pointer to int, or with an l (lowercase
ell) if it is a pointer to long int.
Similarly, precede a conversion specifier of o, u, or x
with an h if the corresponding argument is a pointer to
unsigned short int rather than a pointer to unsigned
int, or with an l (lowercase ell) if it is a pointer to
unsigned long int.
Finally, precede a conversion specifier of e, f, or g
with an l (lowercase ell) if the corresponding argument
is a pointer to double rather than a pointer to float,
or with an L if it is a pointer to long double.
If an h, l, or L appears with any other conversion
specifier, the behavior is undefined.
297.2 - Conversion Specifier
d Expects a decimal integer in the input whose format is
the same as expected for the subject sequence of the
strtol function with the value 10 for the base
argument. The corresponding argument must be a pointer
to int.
i Expects an integer whose type is determined by the
leading input characters. For example, a leading 0 is
equated to octal, a leading 0X is equated to
hexadecimal, and all other forms are equated to
decimal. The corresponding argument must be a pointer
to int.
o Expects an octal integer in the input (with or without
a leading 0). The corresponding argument must be a
pointer to int.
u Expects a decimal integer in the input whose format is
the same as expected for the subject sequence of the
strtoul function with the value 10 for the base
argument.
x Expects a hexadecimal integer in the input (with or
without a leading 0x). The corresponding argument must
be a pointer to unsigned int.
c Expects a single byte in the input. The corresponding
argument must be a pointer to char. If a field width
precedes the c conversion specifier, the number of
characters specified by the field width is read. In
this case, the corresponding argument must be a pointer
to an array of char.
C Expects a multibyte character in the input which is
converted into a wide character code. The
corresponding argument must be a pointer to type
wchar_t. If a field width precedes the C conversion
specifier, the number of characters specified by the
field width is read; in this case, the corresponding
argument must be a pointer to array of wchar_t.
s Expects a sequences of bytes in the input. The
corresponding argument must be a pointer to an array of
characters that is large enough to contain the sequence
plus a terminating null character, which is added
automatically. The input field is terminated by a
space, tab, or new-line character.
S Expects a sequence of multibyte characters in the
input, which are converted to wide-character codes.
The corresponding argument must be a pointer to an
array of wide characters (type wchar_t) that is large
enough to contain the sequence plus a terminating null
wide-character code which is added automatically. The
input field is terminated by a space, tab, or new-line
character.
e,f,g Expects a floating-point number in the input. The
corresponding argument must be a pointer to float. The
input format for floating-point numbers is:
[+|-]nnn[radix][ddd][{E|e}[+|-]nn]
The n's and d's are decimal digits (as many as
indicated by the field width minus the signs and the
letter E). The radix character is defined in the
current locale.
[...] Expects a nonempty sequence of characters that is not
delimited by a white-space character. The brackets
enclose a set of characters (the scanset) expected in
the input sequence. Any character in the input
sequence that does not match a character in the scanset
terminates the character sequence. The corresponding
argument must be a pointer to an array of characters.
All characters between the brackets comprise the
scanset, unless the first character after the left
bracket is a circumflex (^). In this case, the scanset
contains all characters other than those that appear
between the circumflex and the right bracket; that is,
any character that does appear between the circumflex
and the right bracket will terminate the input
character sequence.
If the conversion specifier begins with [] or [^], the
right-bracket character is in the scanset and the next
right-bracket character is the matching right bracket
that ends the specification; otherwise, the first right
bracket character ends the specification.
p An argument that is a pointer to void. The input value
is interpreted as a hexadecimal value.
n No input is consumed. The corresponding argument is a
pointer to an integer. The integer is assigned the
number of characters read from the input stream so far
by this call to the formatted input function.
Execution of a %n directive does not increment the
assignment count returned when the formatted input
function completes execution.
% Matches a single percent symbol. No conversion or
assignment takes place. The complete conversion
specification would be %%.
Curses Screen Management routine that moves all the lines on the
window up one line. The top line scrolls off the window and the
bottom line becomes blank.
Syntax:
#include <curses.h>
int scroll(WINDOW *win);
Curses Screen Management macro that sets the scroll flag for the
specified window.
Syntax:
#include <curses.h>
scrollok(WINDOW *win, bool boolf);
Initializes a 48-bit random number generator.
Syntax:
#include <stdlib.h>
unsigned short *seed48 (unsigned short seed_16v[3]);
Sets the position in a directory to a specified directory entry.
Performs operations on directories.
Syntax:
#include <dirent.h>
void seekdir (DIR *dir_pointer, long int location);
Curses Screen Management function and macro that activate the video
display attributes boldface, blinking, reverse video, and
underlining within the window. The attributes are represented by
_BOLD, _BLINK, _REVERSE, and _UNDERLINE. The setattr macro acts on
the stdscr window.
Syntax:
#include <curses.h>
int setattr(int attr);
wsetattr(WINDOW *win, int attr);
Associates a buffer with an input or output file.
Syntax:
#include <stdio.h>
void setbuf(FILE *file_pointer, char *buffer);
Inserts or resets the environment variable name in the current
environment list.
Syntax:
#include <stdlib.h>
int setenv (const char *name,
const char *value,
int overwrite);
Implemented for program portability and serves no function. It
returns 0 (to indicate success).
Syntax:
#include <unistd.h>
_DECC_V4_SOURCE defined:
int setgid(__gid_t group_number);
_DECC_V4_SOURCE not defined:
gid_t setgid(gid_t group_number);
Sets the value of interval timers.
Syntax:
#include <time.h>
#define ITIMER_REAL 0
#define ITIMER_VIRTUAL 1
#define ITIMER_PROF 2
int setitimer (int which,
struct itimerval *value,
struct itimerval *ovalue);
Provides a way to transfer control from a nested series of function
invocations back to a predefined point without returning normally;
that is, by not using a series of return statements. The setjmp
function saves the context of the environment buffer.
Syntax:
#include <setjmp.h>
int setjmp(jmp_buf env);
Selects the appropriate portion of the program's locale as
specified by the category and locale arguments. This function can
be used to change or query one category or the program's entire
current locale.
Syntax:
#include <locale.h>
char *setlocale(int category, const char *locale);
Restarts, and changes random number generators.
Syntax:
char *setstate (char *state);
Implemented for program portability and serves no function. It
returns 0 (to indicate success).
Syntax:
#include <unistd.h>
_DECC_V4_SOURCE defined:
int setuid(__uid_t member_number);
_DECC_V4_SOURCE not defined:
uid_t setuid(uid_t member_number);
Associates a buffer with an input or output file.
Syntax:
#include <stdio.h>
int setvbuf (FILE *file_ptr, char *buffer, int type,
size_t size);
Specifies the action to take upon delivery of a signal.
Syntax:
#include <signal.h>
int sigaction (int signal,
const struct sigaction *action,
struct sigaction *o_action);
Adds the specified individual signal.
Syntax:
#include <signal.h>
int sigaddset (sigset_t *set, int sig_number);
Causes the signals designated in a mask to be added to the current
set of signals being blocked from delivery.
Syntax:
#include <signal.h>
int sigblock(int mask);
Deletes a specified individual signal.
Syntax:
#include <signal.h>
int sigdelset (sigset_t *set, int sig_number);
Initializes the signal set to exclude all signals.
Syntax:
#include <signal.h>
int sigemptyset (sigset_t *set);
Initializes the signal set to include all signals.
Syntax:
#include <signal.h>
int sigfillset (sigset_t *set);
Tests whether a specified signal is a member of the signal set.
Syntax:
#include <signal.h>
int sigismember (const sigset_t *set, int sig_number);
Nonlocal goto with signal handling.
Syntax:
#include <signal.h>
void siglongjmp (sigjmp_buf env, int value);
Constructs the mask for a given signal number.
Syntax:
#include <signal.h>
int sigmask (signum)
Allows you to specify the way in which the signal sig is to be
handled: use the default handling for the signal, ignore the
signal, or call the signal handler at the address specified.
Syntax:
#include <signal.h>
void (*signal(int sig, void (*func) (int))) (int);
Assigns mask to the current set of masked signals and then waits
for a signal.
Syntax:
#include <signal.h>
int sigpause(int mask);
Examines pending signals.
Syntax:
#include <signal.h>
int sigpending (sigset_t *set);
Sets the current signal mask.
Syntax:
#include <signal.h>
int sigprocmask (int how, const sigset_t *set, sigset_t
*o_set);
Sets jump point for a nonlocal goto.
Syntax:
#include <signal.h>
int sigsetjmp (sigjmp_buf env, int savemask);
Establishes those signals that are blocked from delivery.
Syntax:
#include <signal.h>
int sigsetmask(int mask);
Defines an alternate stack on which to process signals. This
allows the processing of signals in a separate environment from
that of the current process. This function is nonreentrant.
Syntax:
#include <signal.h>
int sigstack(struct sigstack *ss, struct sigstack *oss);
Atomically changes the set of blocked signals and waits for a
signal.
Syntax:
#include <signal.h>
int sigsuspend (const sigset_t *signal_mask);
Permanently assigns a handler for a specific signal.
Syntax:
#include <signal.h>
int sigvec(int sigint, struct sigvec *sv, struct sigvec *osv);
Returns the sine of its radian argument.
Syntax:
#include <math.h>
double sin(double x);
Returns the hyperbolic sine of its argument.
Syntax:
#include <math.h>
double sinh(double x);
Suspends the execution of the current process for at least the
number of seconds indicated by its argument.
Syntax:
#include <unistd.h>
_DECC_V4_SOURCE defined:
unsigned int sleep(unsigned seconds);
_DECC_V4_SOURCE not defined:
int sleep(unsigned seconds);
Performs formatted output to a string in memory.
Syntax:
#include <stdio.h>
int sprintf(char *string, const char *format_string,...);
where the ... represents optional expressions whose resultant
types correspond to conversion specifications given in the format
specification. If no conversion specifications are given, you may
omit the output sources. Otherwise, the function calls must have
at least as many output sources as there are conversion
specifications, and the conversion specifications must match the
types of the output sources. Conversion specifications are matched
to output sources in left-to-right order.
The format string for the output of information can contain two
kinds of items:
o Ordinary characters, which are copied to the output.
o Conversion specifications, each of which causes the conversion
of a corresponding output source to a character string in a
particular format. Conversion specifications are matched to
output sources in left-to-right order.
A conversion specification consists of a % (or a %n$), followed by
one or more optional characters, and concluding with a conversion
specifier.
333.1 - Optional character
flags You can use the following flag characters, alone or in
any combined order, to modify the conversion
specification:
' Requests that a numeric conversion is
formatted with the thousands separator
character. Only the numbers to the left of
the radix character are formatted with the
separator character. The character used as
a separator and the positioning of the
separators are defined in the program's
current locale.
-(hyphen) Left-justifies the converted output source
in its field.
+ Requests that an explicit sign be present on
a signed conversion. If this flag is not
specified, the result of a signed conversion
begins with a sign only when a negative
value is converted.
space Prefixes a space to the result of a signed
conversion, if the first character of the
conversion is not a sign, or if the
conversion results in no characters. If you
specify both the space and the + flag, the
space flag is ignored.
# Requests an alternate form conversion.
Depending on the conversion specified,
different actions will occur. For the o
(octal) conversion, the precision is
increased to force the first digit to be a
0. For the x (or X) conversion, a nonzero
result is prefixed with 0x (or 0X). For e,
E, f, g, and G conversions, the result
contains a decimal point even at the end of
an integer value. For g and G conversions,
trailing zeros are not trimmed. For other
conversions, the effect of # is undefined.
0 Uses zeros rather than spaces to pad the
field width for d, i, o, u, x, X, e, E, f,
g, and G conversions. If both the 0 and the
- flags are specified, then the 0 flag is
ignored. For d, i, o, u, x, and X
conversions, if a precision is specified,
the 0 flag is ignored. For other
conversions, the behavior of the 0 flag is
undefined.
field width The minimum field width can be designated by a decimal
integer constant, or by an output source. To specify
an output source, use an asterisk (*) or the sequence
*n$, where n refers to the nth output source listed
after the format specification. If the converted
output source is wider than the minimum field, write
it out. If the converted output source is narrower
than the minimum width, pad it to make up the field
width. Pad with spaces, by default. Pad with zeros
if the 0 flag is specified; this does not mean that
the width is an octal number. Padding is on the left
by default, and on the right if a minus sign is
specified.
If an asterisk is used for the field width, the
corresponding width is given in the output source.
period (.) Separates the field width from the precision.
precision The precision defines the minimum number of digits to
appear for d, i, o, u, x, and X conversions; the
number of digits to appear after the decimal-point
character for e, E, and f conversions; the maximum
number of significant digits for g and G conversions;
or the maximum number of characters to be written from
a string in an s or S conversion. If a precision
appears with any other conversion specifier, the
behavior is undefined.
Precision can be designated by a decimal integer
constant, or by an output source. To specify an
output source, use an asterisk (*) or the sequence
*n$, where n refers to the nth output source listed
after the format specification.
If only the period is specified, the precision is
taken as 0.
h, l, or L An h specifies that a following d, i, o, u, x, or X
conversion specifier applies to a short int or
unsigned short int argument; an h can also specify
that a following n conversion specifier applies to a
pointer to a short int argument.
An l (lowercase ell) specifies that a following d, i,
o, u, x, or X conversion specifier applies to a long
int or unsigned long int argument; an l can also
specify that a following n conversion specifier
applies to a pointer to a long int argument.
An L specifies that a following e, E, f, g, or G
conversion specifier applies to a long double
argument.
If an h, l, or L appears with any other conversion
specifier, the behavior is undefined.
On Compaq C for OpenVMS VAX and Alpha Systems, int
values are equivalent to long values.
333.2 - Conversion Specifier
d, i Converts an int argument to signed decimal format.
o Converts an unsigned int argument to unsigned octal
format.
u Converts an unsigned int argument to unsigned decimal
format (giving a number in the range 0 to 4,294,967,295).
x, X Converts an unsigned int argument to unsigned hexadecimal
format (with or without a leading 0x). The letters
'abcdef' are used for the x conversion; the letters
'ABCDEF' are used for the X conversion.
f Converts a float or double argument to the format
[-]mmm.nnnnnn. The number of n's is equal to the
precision specification. If no precision is specified,
the default is 6.
If the precision is 0 and the # flag is specified, the
decimal point appears but no n's appear. If the precision
is 0 and the # flag is not specified, the decimal point
also does not appear. If a decimal point appears, at
least one digit appears before it. The value is rounded
to the appropriate number of digits.
e, E Converts a float or double argument to the format
[-]m.nnnnnnE[+|-]xx. The number of n's is specified by
the precision. If no precision is specified, the default
is 6. If the precision is explicitly 0 and the # flag is
specified, the decimal point appears but no n's appear.
If the precision is explicitly 0 and the # flag is not
specified, the decimal point also does not appear. An 'e'
is printed for e conversion; an 'E' is printed for E
conversion. The exponent always contains at least two
digits. If the value is 0, the exponent is 0.
g, G Converts a float or double argument to format f or e (or E
if the G conversion specifier is used), with the precision
specifying the number of significant digits. If the
precision is 0, it is taken as 1.
c Converts an int argument to an unsigned char, and writes
the resulting character (null characters are ignored).
C Converts a wchar_t argument to an array of bytes
representing the character, and writes the resulting
character. If the field width is specified and the
resulting character occupies fewer bytes than the field
width, it will be padded to the given width with space
characters. If the precision is specified, the behavior
is undefined.
s Requires an argument that is a pointer to an array of
characters of type char. The argument is used to write
characters until a null character is encountered or until
the number of characters indicated by the precision
specification is exhausted. If the precision
specification is 0 or omitted, all characters up to a null
are output.
S Converts an array of wide-character codes to multibyte
characters, and writes the multibyte characters. Requires
an argument that is a pointer to an array of wide
characters of type wchar_t. Characters are written until
a null wide character is encountered or until the number
of bytes indicated by the precision specification is
exhausted. If the precision specification is omitted or
is greater than the size of the array of converted bytes,
the array of wide characters must be terminated by a null
wide character.
p Requires an argument that is a pointer to void. The value
of the pointer is output as a hexadecimal character.
n Requires an argument that is a pointer to an integer. The
integer is assigned the number of characters written to
the output stream so far by this call to the formatted
output function. No argument is converted.
% Writes out the percent symbol. No conversion is
performed. The complete conversion specification would be
%%.
Returns the square root of its argument.
Syntax:
#include <math.h>
double sqrt(double x);
Initializes the pseudorandom number generator.
Syntax:
#include <math.h>
void srand(unsigned int seed);
Initializes a 48-bit random number generator.
Syntax:
#include <stdlib.h>
void srand48 (long int seed_val);
Uses its argument as a seed for a new sequence of pseudorandom
numbers to be returned by subsequent calls to the random function.
Syntax:
int srandom (unsigned seed);
Performs formatted input from a character string in memory.
Syntax:
#include <stdio.h>
int sscanf(const char *string, const char *format_string,...);
where the ... represents optional expressions that are pointers to
objects whose resultant types correspond to conversion
specifications given in the format_string. If no conversion
specifications are given, you can omit the input pointers.
Otherwise, the function calls must have at least as many input
pointers as there are conversion specifications, and the conversion
specifications must match the types of the input pointers.
Conversion specifications are matched to input sources in
left-to-right order.
The format string for the input of information can include three
kinds of items:
o White-space characters (spaces, tabs, and new-line characters),
which match optional white-space characters in the input field.
o Ordinary characters (not %), which must match the next
nonwhite-space character in the input.
o Conversion specifications, which govern the conversion of the
characters in an input field and their assignment to an object
indicated by a corresponding input pointer.
A conversion specification consists of the following characters, in
the order listed:
o A percent character (%) or the sequence %n$ (where n is an
integer).
The sequence %n$ denotes that the conversion is applied to
the nth input pointer listed, where n is a decimal integer
between [1, NL_ARGMAX] (see the <limits.h> header file).
For example, a conversion specification beginning %5$ means
that the conversion will be applied to the 5th input
pointer listed after the format specification. The
sequence %$ is invalid. If the conversion specification
does not begin with the sequence %n$ the conversion
specification is matched to its input pointer in
left-to-right order. You should only use one type of
conversion specification (% or %n$) in a format
specification.
o One or more optional characters
o A conversion specifier.
338.1 - Optional character
* Assignment-suppressing character.
field width Nonzero decimal integer that specifies the maximum
field width.
h, l, or L Precede a conversion specifier of d, i, or n with an h
if the corresponding argument is a pointer to short int
rather than a pointer to int, or with an l (lowercase
ell) if it is a pointer to long int.
Similarly, precede a conversion specifier of o, u, or x
with an h if the corresponding argument is a pointer to
unsigned short int rather than a pointer to unsigned
int, or with an l (lowercase ell) if it is a pointer to
unsigned long int.
Finally, precede a conversion specifier of e, f, or g
with an l (lowercase ell) if the corresponding argument
is a pointer to double rather than a pointer to float,
or with an L if it is a pointer to long double.
If an h, l, or L appears with any other conversion
specifier, the behavior is undefined.
338.2 - Conversion Specifier
d Expects a decimal integer in the input whose format is
the same as expected for the subject sequence of the
strtol function with the value 10 for the base
argument. The corresponding argument must be a pointer
to int.
i Expects an integer whose type is determined by the
leading input characters. For example, a leading 0 is
equated to octal, a leading 0X is equated to
hexadecimal, and all other forms are equated to
decimal. The corresponding argument must be a pointer
to int.
o Expects an octal integer in the input (with or without
a leading 0). The corresponding argument must be a
pointer to int.
u Expects a decimal integer in the input whose format is
the same as expected for the subject sequence of the
strtoul function with the value 10 for the base
argument.
x Expects a hexadecimal integer in the input (with or
without a leading 0x). The corresponding argument must
be a pointer to unsigned int.
c Expects a single byte in the input. The corresponding
argument must be a pointer to char. If a field width
precedes the c conversion specifier, the number of
characters specified by the field width is read. In
this case, the corresponding argument must be a pointer
to an array of char.
C Expects a multibyte character in the input which is
converted into a wide character code. The
corresponding argument must be a pointer to type
wchar_t. If a field width precedes the C conversion
specifier, the number of characters specified by the
field width is read; in this case, the corresponding
argument must be a pointer to array of wchar_t.
s Expects a sequences of bytes in the input. The
corresponding argument must be a pointer to an array of
characters that is large enough to contain the sequence
plus a terminating null character, which is added
automatically. The input field is terminated by a
space, tab, or new-line character.
S Expects a sequence of multibyte characters in the
input, which are converted to wide-character codes.
The corresponding argument must be a pointer to an
array of wide characters (type wchar_t) that is large
enough to contain the sequence plus a terminating null
wide-character code which is added automatically. The
input field is terminated by a space, tab, or new-line
character.
e,f,g Expects a floating-point number in the input. The
corresponding argument must be a pointer to float. The
input format for floating-point numbers is:
[+|-]nnn[radix][ddd][{E|e}[+|-]nn]
The n's and d's are decimal digits (as many as
indicated by the field width minus the signs and the
letter E). The radix character is defined in the
current locale.
[...] Expects a nonempty sequence of characters that is not
delimited by a white-space character. The brackets
enclose a set of characters (the scanset) expected in
the input sequence. Any character in the input
sequence that does not match a character in the scanset
terminates the character sequence. The corresponding
argument must be a pointer to an array of characters.
All characters between the brackets comprise the
scanset, unless the first character after the left
bracket is a circumflex (^). In this case, the scanset
contains all characters other than those that appear
between the circumflex and the right bracket; that is,
any character that does appear between the circumflex
and the right bracket will terminate the input
character sequence.
If the conversion specifier begins with [] or [^], the
right-bracket character is in the scanset and the next
right-bracket character is the matching right bracket
that ends the specification; otherwise, the first right
bracket character ends the specification.
p An argument that is a pointer to void. The input value
is interpreted as a hexadecimal value.
n No input is consumed. The corresponding argument is a
pointer to an integer. The integer is assigned the
number of characters read from the input stream so far
by this call to the formatted input function.
Execution of a %n directive does not increment the
assignment count returned when the formatted input
function completes execution.
% Matches a single percent symbol. No conversion or
assignment takes place. The complete conversion
specification would be %%.
Allows you to specify the action to take when a particular signal
is raised.
Syntax:
#include <signal.h>
void (*ssignal (int sig, void (*func) (int,...))) (int,...);
Curses Screen Management function and macro that deactivate the
boldface attribute for the specified window. The standend macro
acts on the stdscr window.
Syntax:
#include <curses.h>
int standend(void);
int wstandend(WINDOW *win);
Curses Screen Management function and macro that activate the
boldface attribute of the specified window. The standout macro
acts on the stdscr window.
Syntax:
#include <curses.h>
int standout(void);
int wstandout(WINDOW *win);
Accesses information about the file descriptor or the file
specification.
Syntax:
#include <stat.h>
int stat(const char *file_spec, struct stat *buffer);
(POSIX-1)
int stat(const char *file_spec, struct stat *buffer,...);
(Compaq C Extension)
Compares two 7 bit ASCII strings with the case insensitive.
Syntax:
#include <strings.h>
int strcasecmp (const char *s1, const char *s2);
Concatenates str_2, including the terminating null character, to
the end of str_1.
Syntax:
#include <string.h>
char *strcat(char *str_1, const char *str_2);
Returns the address of the first occurrence of a given character in
a null-terminated string. The terminating null character is
considered to be part of the string.
Syntax:
#include <string.h>
char *strchr(const char *string, int character);
Compares two strings and returns an integer that indicates if the
strings differ and how they differ. The function uses the
collating information in the LC_COLLATE category of the current
locale to determine how the comparison is performed.
Syntax:
#include <string.h>
int strcoll(const char *str_1, const char *str_2);
Compares two ASCII character strings and returns a negative, 0, or
positive integer, indicating that the ASCII values of the
individual characters in the first string are less then, equal to,
or greater than the values in the second string.
Syntax:
#include <string.h>
int strcmp(const char *str_1, const char *str_2);
Copies all of source_str, including the terminating null character,
into destination_str.
Syntax:
#include <string.h>
char *strcpy(char *destination_str, const char *source_str);
Returns the length of the prefix of a string that consists entirely
of characters that are not in a specified set of characters.
Syntax:
#include <string.h>
size_t strcspn(const char *str, const char *charset);
Finds and points to a duplicate string.
Syntax:
#include <string.h>
char *strdup (const char *s1);
Maps the error number in error_code to a locale-dependent error
message string.
Syntax:
#include <string.h>
char *strerror (int error_code); (ANSI C)
char *strerror (int error_code [,int vms_error_code]); (Compaq
C Extension)
{Relaxed ANSI and VAXC modes only}
This function uses the error number in error_code to retrieve the
appropriate locale-dependent error message. The contents of the
error message strings are determined by the LC_MESSAGES category of
the program's current locale.
For Compaq C (not Compaq C++) in relaxed ANSI mode or VAXC mode,
strerror has a second argument (vms_error_code), which is used in
the following way:
o If error_code is EVMSERR and there is a second argument,
then that second argument is used as the VAXC$ERRNO value.
o If error_code is EVMSERR and there is no second argument,
look at VAXC$ERRNO to get the OpenVMS error condition.
Use of the second argument is not included in the ANSI C definition
of strerror and is, therefore, not portable.
Converts a number of monetary values into a string. The conversion
is controlled by a format string.
Syntax:
#include <monetary.h>
size_t strfmon (char *s, size_t maxsize, const char *format,
...);
Uses date and time information stored in a tm structure to create
an output string. The format of the output string is controlled by
a format string.
Syntax:
#include <time.h>
size_t strftime(char *str, size_t maxsize, const char *format,
const struct tm *timeptr);
Returns the length of a string of ASCII characters. The returned
length does not include the terminating null character (\0).
Syntax:
#include <string.h>
size_t strlen(const char *str);
Compares two 7 bit ASCII strings for case and size, with case
insensitivity.
Syntax:
#include <strings.h>
int strncasecmp (const char *s1, const char *s2, size_t n);
Appends not more than maxchar characters from str_2 to the end of
str_1.
Syntax:
#include <string.h>
char *strncat(char *str_1, const char *str_2, size_t maxchar);
Compares not more than maxchar characters of two ASCII character
strings and returns a negative, 0, or positive integer, indicating
that the ASCII values of the individual characters in the first
string are less than, equal to, or greater than the values in the
second string.
Syntax:
#include <string.h>
int strncmp(const char *str_1, const char *str_2,
size_t maxchar);
Copies all or part of source_str into destination_str.
Syntax:
#include <string.h>
char *strncpy(char *destination_str, const char *source_str,
size_t maxchar);
Returns the number of bytes in the string pointed to by s. The
string length value does not include the terminating null
character. The strnlen function counts bytes until the first null
byte or until n bytes have been examined.
Syntax:
#include <string.h>
size_t strnlen(const char *s, size_t n);
Searches a string for the occurrence of one of a specified set of
characters.
Syntax:
#include <string.h>
char *strpbrk(const char *str, const char *charset);
Converts a character string into date and time values stored in a
tm structure. Conversion is controlled by a format string.
Syntax:
#include <time.h>
char *strptime (const char *buf, const char *format, struct tm
*timeptr);
Returns the address of the last occurrence of a given character in
a null-terminated string. The terminating null character is
considered to be part of the string.
Syntax:
#include <string.h>
char *strrchr(const char *string, int character);
Separates strings.
Syntax:
#include <string.h>
char *strsep (char **stringp, char *delim);
Searches a string for the occurrence of a character that is not in
a specified set of characters.
Syntax:
#include <string.h>
size_t strspn(const char *str, const char *charset);
Locates the first occurrence in the string pointed to by s1 of the
sequence of characters in the string pointed to by s2.
Syntax:
#include <string.h>
char *strstr(const char *s1, const char *s2);
Converts a given string to a double-precision number.
Syntax:
#include <stdlib.h>
double strtod (const char *nptr, char **endptr);
Locates text tokens in a given string.
Syntax:
#include <string.h>
char *strtok (char *s1, const char *s2);
Converts strings of ASCII characters to the appropriate numeric
values.
Syntax:
#include <stdlib.h>
long int strtol (const char *nptr, char **endptr, int base);
Converts the initial portion of the string pointed to by nptr to an
unsigned long integer.
Syntax:
#include <stdlib.h>
unsigned long int strtoul (const char *nptr, char **endptr,
int base);
Changes a string such that the changed string can be passed to the
strcmp function and produce the same result as passing the
unchanged string to the strcoll function.
Syntax:
#include <string.h>
size_t strxfrm(char *s1, const char *s2, size_t maxchar);
Curses Screen Management routine that creates a new subwindow with
numlines lines and numcols columns starting at the coordinates
(begin_y, begin_x) on the terminal screen.
Syntax:
#include <curses.h>
WINDOW *subwin(WINDOW *win, int numlines, int numcols,
int begin_y, int begin_x);
Swaps bytes.
Syntax:
#include <unistd.h>
void swab (const void *src, void *dest, ssize_t nbytes);
Formats output to an array of wide characters.
Syntax:
#include <wchar.h>
int swprintf (wchar_t *s, size_t n,
const wchar_t *format, ...);
Formats input to a wide string input.
Syntax:
#include <wchar.h>
int swscanf (const wchar_t *s, const wchar_t *format, ...);
Gets configurable system variables.
Syntax:
#include <unistd.h>
long int sysconf (int name);
Passes a given string to the host environment to be executed by a
command processor. This function is nonreentrant.
Syntax:
#include <stdlib.h>
int system (const char *string);
Returns a double value that is the tangent of its radian argument.
Syntax:
#include <math.h>
double tan(double x);
Returns a double value that is the hyperbolic tangent of its double
argument.
Syntax:
#include <math.h>
double tanh(double x);
Returns the current location associated with a specified directory
stream. Performs operations on directories.
Syntax:
#include <dirent.h>
long int telldir (DIR *dir_pointer);
Constructs the name for a temporary file.
Syntax:
#include <stdio.h>
char *tempnam (const char *directory, const char *prefix);
Returns the time elapsed on the system since 00:00:00 January 1,
1970, in seconds.
Syntax:
#include <time.h>
time_t time(time_t *time_location);
Passes back the accumulated times of the current process and its
terminated child processes. This function is nonreentrant.
Syntax:
#include <times.h>
clock_t times (struct tms *buffer); (POSIX-1)
void times (tbuffer_t *buffer); (Compatibility)
Creates a temporary file that is opened for update.
Syntax:
#include <stdio.h>
FILE *tmpfile(void);
Creates a character string that you can use in place of the
file-name argument in other function calls.
Syntax:
#include <stdio.h>
char *tmpnam(char *name);
Converts its argument, an 8-bit ASCII character, to a 7-bit ASCII
character.
Syntax:
#include <ctype.h>
int toascii(char character);
Convert their argument, a character, to lowercase. If the argument
is not an uppercase character, it is returned unchanged.
Syntax:
#include <ctype.h>
int tolower(int character);
int _tolower(int character);
Curses Screen Management routine that places the most recently
edited version of the specified window on the terminal screen.
Syntax:
#include <curses.h>
int touchwin(WINDOW *win);
Convert their argument, a character, to uppercase. If the argument
is not a lowercase character, it is returned unchanged.
Syntax:
#include <ctype.h>
int toupper(int character);
int _toupper(int character);
Maps one wide character to another according to a specified mapping
descriptor.
Syntax:
#include <wctype.h>
wint_t towctrans (wint_t wc, wctrans_t desc);
Converts the argument, a wide character, to lowercase. If the
argument is not an uppercase character, it is returned unchanged.
Syntax:
#include <wctype.h> (ISO C Standard)
#include <wchar.h> (XPG4 Standard)
int towlower(wint_t wc);
Converts the argument, a wide character, to uppercase. If the
argument is not a lowercase character, it is returned unchanged.
Syntax:
#include <wctype.h> (ISO C Standard)
#include <wchar.h> (XPG4 Standard)
int towupper(wint_t wc);
Changes file length to a specified length in bytes.
Syntax:
#include <unistd.h>
int truncate (const char *path, off_t length);
Returns a pointer to the null-terminated name of the terminal
device associated with file descriptor 0, the default input device
(stdin).
Syntax:
#include <unixio.h>
char *ttyname(void);
Sets and accesses timezone conversion.
Syntax:
#include <time.h>
void tzset (void):
extern int daylight;
extern long timezone;
extern char *tzname[];
Sets or changes the timeout of interval timers.
Syntax:
#include <unistd.h>
useconds_t ualarm (useconds_t mseconds,
useconds_t interval);
Creates a file protection mask that is used when a new file is
created and returns the previous mask value.
Syntax:
#include <stat.h>
mode_t umask(mode_t mode_complement);
Gets system identification information.
Syntax:
#include <utsname.h>
int uname (struct utsname *name);
Pushes a character back into the input stream and leaves the stream
positioned before the character.
Syntax:
#include <stdio.h>
int ungetc(int character, FILE *file_pointer);
Pushes a wide character back into the input stream and leaves the
stream positioned before the character.
Syntax:
#include <wchar.h>
wint_t ungetwc(wint_t wc, FILE *file_pointer);
Deletes all instances of the variable name pointed to the name from
the environment list.
Syntax:
#include <stdlib.h>
void unsetenv (const char *name);
Suspends execution for an interval.
Syntax:
#include <unistd.h>
int usleep (unsigned int mseconds);
Sets file access and modification times.
Syntax:
#include <types.h>
int utime (const char *path, const struct utimbuf *times);
Sets file access and modification times.
Syntax:
#include <time.h>
int utimes (const char *path, const struct timeval *times[2]);
Returns the next item in the argument list.
Syntax:
#include <stdarg.h> (ANSI C)
#include <varargs.h> (Compaq C Extension)
type va_arg(va_list ap, type);
405 - va count (Compaq C Extension)
|
Returns the number of longwords in the argument list.
Syntax:
#include <stdarg.h>
OR
#include <varargs.h> (Compaq C Extension)
void va_count(int *count);
Finishes the varargs or stdarg session.
Syntax:
#include <stdarg.h> (ANSI C)
#include <varargs.h> (Compaq C Extension)
void va_end(va_list ap);
Initializes a variable to the beginning of the argument list.
Syntax:
Nonportable format:
#include <varargs.h> (Compaq C Extension)
void va_start(va_list ap);
Portable format:
#include <stdarg.h> (ANSI C)
void va_start(va_list ap, parmN);
Initializes a variable to the beginning of the argument list.
Syntax:
#include <varargs.h> (Compaq C Extension)
void va_start_1(va_list ap, int offset);
Allows you to call the Compaq C RTL from other languages. It
initializes the run-time environment and establishes both an exit
and condition handler. VAXC$CRTL_INIT is a synonym for
decc$crtl_init. Either name invokes the same routine.
Syntax:
#include <signal.h>
void VAXC$CRTL_INIT();
Used to establish an OpenVMS exception handler for a particular
routine. This function establishes a special Compaq C RTL
exception handler in the routine that called it. This special
handler catches all RTL-related exceptions that occur in later
routines, and passes on all other exceptions to your handler.
Syntax:
#include <signal.h>
void vaxc$establish(unsigned int (*exception_handler)(void
*sigarr, void *mecharr));
Creates an independent child process. This function is
nonreentrant.
Syntax:
#include <unistd.h>
_DECC_V4_SOURCE defined:
int vfork(void);
_DECC_V4_SOURCE not defined:
pid_t vfork(void);
Prints formatted output based on an argument list. This function
is the same as the fprintf function except that instead of being
called with a variable number of arguments, it is called with an
argument list that has been initialized by the macro va_start (and
possibly subsequent va_arg calls).
Syntax:
#include <stdio.h>
int vfprintf (FILE *file_ptr, const char *format,
va_list arg);
Writes output to a specified file in wide character format.
Syntax:
#include <wchar.h>
int vfwprintf (FILE *stream,
const wchar_t *format,
va_list arg);
Prints formatted output based on an argument list. This function
is the same as the printf function except that instead of being
called with a variable number of arguments, it is called with an
argument list that has been initialized by the macro va_start (and
possibly subsequent va_arg calls).
Syntax:
#include <stdio.h>
int vprintf (const char *format, va_list arg);
Writes output to a specified file in wide character format.
Syntax:
#include <wchar.h>
int vswprintf (wchar_t *s,
size_t n,
const wchar_t *format,
va_list arg);
Writes output to a specified file in wide character format.
Syntax:
#include <wchar.h>
int vwprintf (const wchar_t *format, va_list arg);
Prints formatted output based on an argument list. This function
is the same as the sprintf function except that instead of being
called with a variable number of arguments, it is called with an
argument list that has been initialized by the macro va_start (and
possibly subsequent va_arg calls).
Syntax:
#include <stdio.h>
int vsprintf (char *str, const char *format, va_list arg);
Checks the status of the child process before exiting. A child
process is terminated when the parent process terminates. This
function is nonreentrant.
Syntax:
#include <wait.h>
pid_t wait(int *status);
Waits for a child process to stop or terminate.
Syntax:
#include <wait.h>
pid_t wait3 (int *status_location,
int options,
struct rusage *resource_usage);
Waits for a child process to stop or terminate.
Syntax:
#include <wait.h>
pid_t wait4 (pid_t process_id,
union wait *status_location,
int options,
struct rusage *resource_usage);
Waits for a child process to stop or terminate.
Syntax:
#include <wait.h>
pid_t waitpid (pid_t process_id,
int *status_location,
int options);
Determines the number bytes needed to represent the multibyte
character that corresponds to the specified wide character.
Syntax:
#include <wchar.h>
size_t wcrtomb (char *s, wchar_t wc, mbstate_t *ps);
Appends the wide character string wstr_2, including the terminating
null character, to the end of wstr_1.
Syntax:
#include <wchar.h>
wchar_t *wcscat (wchar_t *wstr_1, const wchar_t *wstr_2)
Returns the address of the first occurrence of a given wide
character in a null-terminated, wide-character string. The
terminating null character is considered to be part of the string.
Syntax:
#include <wchar.h>
wchar_t *wcschr (const wchar_t *wstr, wchar_t wc);
Compares two wide-character strings. The function returns an
integer that indicates if the strings are different and how they
differ. Unlike the wcscoll function, wcscmp compares the string
based on the binary value of each wide character.
Syntax:
#include <wchar.h>
int wcscmp (const wchar_t *wstr_1, const wchar_t wstr_2);
Compares two wide-character strings. The function returns an
integer that indicates if the strings differ and how they differ.
The function uses the collating information in the LC_COLLATE
category of the current locale to determine how the comparison is
performed.
Syntax:
#include <wchar.h>
int wcscoll (const wchar_t *ws1, const wchar_t *ws2);
Copies the wide-character string source_str, including the
terminating null character, into destination_str.
Syntax:
#include <wchar.h>
wchar_t *wcscpy (wchar_t *destination_str, const wchar_t
*source_str);
Compares the characters in a wide-character string against a set of
wide characters. The function returns the length of the initial
substring comprised entirely of characters that are not in the set
of wide characters.
Syntax:
#include <wchar.h>
size_t wcscspn (const wchar_t *wstr1, const wchar_t *wstr2);
Uses date and time information stored in a tm structure to create a
wide character output string. The format of the output string is
controlled by a format string.
Syntax:
#include <wchar.h>
size_t wcsftime (wchar_t *wcs, size_t maxsize,
const char *format, const struct tm *timeptr); (XPG4)
size_t wcsftime (wchar_t *wcs, size_t maxsize,
const wchar_t *format, const struct tm *timeptr); (ISO C)
Returns the number of wide characters in a wide-character string.
The returned length does not include the terminating null
character.
Syntax:
#include <wchar.h>
size_t wcslen (const wchar_t *wstr);
Appends wide characters from the wide-character string wstr_2 to
the end of wstr_1. Up to a maximum of maxchar characters are
appended to wstr_1.
Syntax:
#include <wchar.h>
wchar_t *wcsncat (wchar_t *wstr_1, const wchar_t *wstr_2,
size_t maxchar);
Compares no more than maxchar characters of two wide-character
strings. The function returns an integer that indicates if the
strings are different and how they differ.
Syntax:
#include <wchar.h>
int wcsncmp (const wchar_t *wstr_1, const wchar_t *wstr_2,
size_t maxchar);
Copies up to a maximum of maxchar wide characters from source_str
into destination_str.
Syntax:
#include <wchar.h>
wchar_t *wcsncpy (wchar_t *destination_str, const wchar_t
*source_str, size_t maxchar);
Searches a wide-character string for the first occurrence of one of
a specified set of wide characters.
Syntax:
#include <wchar.h>
wchar_t *wcspbrk const wchar_t *wstr, const wchar_t *charset);
Returns the address of the last occurrence of a given wide
character in a null-terminated, wide-character string. The
terminating null character is considered to be part of the string.
Syntax:
#include <wchar.h>
wchar_t *wcsrchr (const wchar_t *wstr, wchar_t wc);
Converts a sequence of wide characters to a corresponding sequence
of multibyte characters, including a terminating null character.
Syntax:
#include <wchar.h>
size_t wcsrtombs (char *dst,
const wchar_t **src,
size_t len,
mbstate_t *ps);
Compares the characters in a wide-character string against a set of
wide characters. The function returns the length of the initial
substring comprised entirely of characters in the set of wide
characters.
Syntax:
#include <wchar.h>
size_t wcsspn (const wchar_t *wstr1, const wchar_t *wstr2);
Locates the first occurence of a wide character sequence specified
in one string to wide character sequence in another string.
Syntax:
#include <wchar.h>
wchar_t *wcsstr (const wchar_t *s1, const wchar_t *s2);
Converts a given wide-character string to a double-precision
number.
Syntax:
#include <wchar.h>
double wcstod (const wchar_t *nptr, wchar_t **endptr);
Locates text tokens in a given wide-character string. The text
tokens are delimited by one or more wide characters from a
specified separator string. This function keeps track of its
position in the wide-character string between calls and, as
successive calls are made, the function works through the
wide-character string, identifying the text token following the one
identified by the previous call.
The ptr argument is used only with the ISO C format. It is a
caller-provided w_char pointer into which wcstok stores information
necessary for it to continue scanning the same wide string. When
ws1 is NULL, ptr is used. When ws1 is not NULL, ptr is ignored.
Syntax:
#include <wchar.h>
wchar_t *wcstok wchar_t *ws1, const wchar_t *ws2); (XPG4
Standard)
wchar_t *wcstok wchar_t *ws1, const wchar_t *ws2, wchar_t
**ptr); (ISO C Standard)
Converts a wide character string, in a given base, to a long
integer value.
Syntax:
#include <wchar.h>
long int wcstol (const wchar_t *nptr, wchar_t **endptr, int
base);
Converts a sequence of wide-character codes to a sequence of
multibyte characters.
Syntax:
#include <stdlib.h>
size_t wcstombs(char *s, const wchar_t *pwcs, size_t n);
Converts the initial portion of the wide-character string pointed
to by nptr to an unsigned long integer.
Syntax:
#include <wchar.h>
unsigned long int wcstoul(const wchar_t *nptr, wchar_t
**endptr, int base);
Locates the first occurrence in the string pointed to by wstr1 of
the sequence of wide characters in the string pointed to by wstr2.
Syntax:
#include <wchar.h>
wchar_t *wcswcs (const wchar_t *wstr1, const wchar_t *wstr2);
Determines the number of printing positions on a display device
that are required for a wide-character string.
Syntax:
#include <wchar.h>
int wcswidth (const wchar_t *pwcs, size_t n);
Changes a wide-character string such that the changed string can be
passed to the wcscmp function and produce the same result as
passing the unchanged string to the wcscoll function.
Syntax:
#include <wchar.h>
size_t wcsxfrm (wchar_t *ws1, const wchar_t *ws2, size_t
maxchar);
Determines if a character is a valid single byte multibyte
character in the initial shift state.
Syntax:
#include <stdio.h>
#include <wchar.h>
int wctob (wint_t c);
Converts a wide character to its multibyte character
representation.
Syntax:
#include <stdlib.h>
int wctomb(char *s, wchar_t wchar);
Verifies that a specified string value has a valid wide character
equivalent.
Syntax:
#include <wctype.h>
wctrans_t wctrans (const char *property);
Used to define a property. The value returned by this function is
used in calls to the iswctype function.
Syntax:
#include <wctype.h> (ISO C Standard)
#include <wchar.h> (XPG4 Standard)
wctype_t wctype (const char *property);
Determines the number of printing positions on a display device
required for a wide character.
Syntax:
#include <wchar.h>
int wcwidth (wchar_t wc);
Finds the first occurence of wide characters in a given object.
Syntax:
#include <wchar.h>
wchar_t wmemchr (const wchar_t *s, wchar_t c, size_t n);
Compares the first occurance of wide characters in two objects.
Syntax:
#include <wchar.h>
int wmemcmp (const wchar_t *s1, const wchar_t *s2, size_t n);
Copies a specified number of wide characters from one array
(source_str) to another (destination_str).
Syntax:
#include <wchar.h>
wchar_t wmemcpy (wchar_t *destination_str, const wchar_t
*source_str, size_t n);
Copies a specified number of wide characters from one array to
another, using a temporary array.
Syntax:
#include <wchar.h>
wchar_t wmemmove (wchar_t *destination_str, const wchar_t
*source_str, size_t n);
Sets a specified value to a specified number of wide characters in
an object.
Syntax:
#include <wchar.h>
wchar_t wmemset (wchar_t *s, wchar_t c, size_t n);
Performs formatted output from the standard output (stdout). See
Chapter 2 for information on format specifiers.
Syntax:
#include <wchar.h>
int wprintf (const wchar_t *format, ...);
Curses macro which, in the UNIX* system environment, allows the
wrapping of a word from the right border of the window to the
beginning of the next line. This macro is provided only for UNIX
compatibility.
Syntax:
#include <curses.h>
wrapok(WINDOW *win, bool boolf);
----------
* UNIX is a trademark of The Open Group.
Writes a specified number of bytes from a buffer to a file.
Syntax:
#include <unistd.h>
int write(int file_descriptor, void *buffer,int nbytes);
(POSIX-1)
int write(int file_descriptor, void *buffer,int nbytes);
(Compatibility)
Writes to a file.
Syntax:
#include <unistd.h>
ssize_t writev (int fildes, const struct iovec *iov, int
iovcnt);
Performs formatted input from the standard input (stdin),
interpreting it according to the format specification. See Chapter
2 for information on format specifiers.
Syntax:
#include <wchar.h>
int wscanf (const wchar_t *format, ...);
[legal]
[privacy]
[GNU]
[policy]
[netiquette]
[sponsors]
[FAQ]
Polarhome, production since 1999.
Member of Polarhome portal.