HP C
Run-Time Library Reference Manual for OpenVMS Systems


Previous Contents Index


ccosh (ALPHA, I64)

Returns the complex hyperbolic cosine of its argument.

Format

#include <complex.h>

double complex ccosh (double complex z);

float complex ccoshf (float complex z);

long double complex ccoshl (long double complex z);


Argument

z

A complex value.

Description

The ccosh functions return the complex hyperbolic cosine of z.

Return Values

x The complex hyperbolic cosine value.

ceil

Returns the smallest integer that is greater than or equal to its argument.

Format

#include <math.h>

double ceil (double x);

float ceilf (float x); (ALPHA, I64)

long double ceill (long double x); (ALPHA, I64)


Argument

x

A real value.

Return Value

n The smallest integer greater than or equal to the function argument.

cexp (ALPHA, I64)

Returns the complex exponent of its argument.

Format

#include <complex.h>

double complex cexp (double complex z);

float complex cexpf (float complex z);

long double complex cexpl (long double complex z);


Argument

z

A complex value.

Description

The cexp functions compute the complex exponential value of z, defined as e**z, where e is the constant used as a base for natural logarithms.

Return Values

x The complex exponential value of the argument.

cfree

Makes available for reallocation the area allocated by a previous calloc , malloc , or realloc call. This function is AST-reentrant.

Format

#include <stdlib.h>

void cfree (void *ptr);


Argument

ptr

The address returned by a previous call to malloc , calloc , or realloc .

Description

The contents of the deallocated area are unchanged.

In HP C for OpenVMS Systems, the free and cfree functions are equivalent. Some other C implementations use free with malloc or realloc , and cfree with calloc . However, since the ANSI C standard does not include cfree , using free may be preferable.

See also free .


chdir

Changes the default directory.

Format

#include <unistd.h>

int chdir (const char *dir_spec); (ISO POSIX-1)

int chdir (const char *dir_spec, ...); (HP C EXTENSION)


Arguments

dir_spec

A null-terminated character string naming a directory in either an OpenVMS or UNIX style specification.

...

This argument is an HP C extension available when not defining any of the standards-related feature-test macros (see Section 1.5) and not compiling in strict ANSI C mode (/STANDARD=ANSI89). The argument is an optional flag of type int that 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.


Description

The chdir function changes the default directory. The change can be permanent or temporary. Permanent means that the new directory remains as the default directory after the image exits. Temporary means that on image exit, the default is set to whatever it was before the execution of the image.

There are two ways of making the change permanent:

Otherwise, the change is temporary.


Return Values

0 Indicates that the directory is successfully changed to the given name.
- 1 Indicates that the change attempt has failed.

chmod

Changes the file protection of a file.

Format

#include <stat.h>

int chmod (const char *file_spec, mode_t mode);


Arguments

file_spec

The name of an OpenVMS or UNIX style file specification.

mode

A file protection. Modes are constructed by performing a bitwise OR on any of the values shown in Table REF-2.

Table REF-2 File Protection Values and Their Meanings
Value Privilege
0400 OWNER:READ
0200 OWNER:WRITE
0100 OWNER:EXECUTE
0040 GROUP:READ
0020 GROUP:WRITE
0010 GROUP:EXECUTE
0004 WORLD:READ
0002 WORLD:WRITE
0001 WORLD:EXECUTE

When you supply a mode value of 0, the chmod function gives the file the user's default file protection.

The system is given the same privileges as the owner. A WRITE privilege also implies a DELETE privilege.


Description

You must have a WRITE privilege for the file specified to change the mode.

The C RTL does not support the S_ISVTX bit. Setting the S_ISVTX mode has no effect.


Return Values

0 Indicates that the mode is successfully changed.
- 1 Indicates that the change attempt has failed.

chown

Changes the user ID and group ID of the specified file.

Format

#include <unistd.h>

int chown (const char *file_spec, uid_t owner, gid_t group);


Arguments

file_spec

The address of an ASCII file name.

owner

The new user ID of the file.

group

The new group ID of the file.

Return Values

0 Indicates success.
- 1 Indicates failure.

cimag (ALPHA, I64)

Returns the imaginary part of its complex argument.

Format

#include <complex.h>

double cimag (double complex z);

float cimagf (float complex z);

long double cimagl (long double complex z);


Argument

z

A complex value.

Description

The cimag functions return the imaginary part of z as a real number.

Return Values

x The imaginary part value.

[w]clear

Erase the contents of the specified window and reset the cursor to coordinates (0,0). The clear function acts on the stdscr window.

Format

#include <curses.h>

int clear();

int wclear (WINDOW *win);


Argument

win

A pointer to the window.

Return Values

OK Indicates success.
ERR Indicates an error.

clearerr

Resets the error and end-of-file indicators for a file (so that ferror and feof will not return a nonzero value).

Format

#include <stdio.h>

void clearerr (FILE *file_ptr);


Argument

file_ptr

A file pointer.

clearerr_unlocked (ALPHA, I64)

Same as the clearerr function, except used only within a scope protected by flockfile and funlockfile .

Format

#include <stdio.h>

void clearerr_unlocked (FILE *file_ptr);


Argument

file_ptr

A file pointer.

Description

The reentrant version of the clearerr function is locked against multiple threads calling it simultaneously. This incurs overhead to ensure integrity of the stream. The unlocked version of this call, clearerr_unlocked can be used to avoid the overhead. The clearerr_unlocked macro is functionally identical to the clearerr macro, except that it is not required to be implemented in a thread-safe manner. The clearerr_unlocked function can be safely used only within a scope that is protected by the flockfile and funlockfile functions used as a pair. The caller must ensure that the stream is locked before clearerr_unlocked is used.

See also flockfile , ftrylockfile , and funlockfile .


clearok

Sets the clear flag for the window.

Format

#include <curses.h>

clearok (WINDOW *win, bool boolf);


Arguments

win

The entire size of the terminal screen. You can use the windows stdscr and curscr with clearok .

boolf

A Boolean value of TRUE or FALSE. If the argument is TRUE, this forces a clearscreen to be printed on the next call to refresh , or stops the screen from being cleared if boolf is FALSE.

The type bool is defined in the <curses.h> header file as follows:


#define bool int 


Description

Unlike the clear function, the clearok function does not alter the contents of the window. If the win argument is curscr , the next call to refresh causes a clearscreen, even if the window passed to refresh is not a window the size of the entire terminal screen.

clock

Determines the CPU time (in 10-millisecond units) used since the beginning of the process. 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 .

Format

#include <time.h>

clock_t clock (void);


Description

The value returned by the clock function must be divided by the value of the CLK_TCK, as defined in the standard header file <time.h> , to obtain the time in seconds.

The type clock_t is defined in the <time.h> header file as follows:


typedef long int clock_t; 

Only the accumulated times for child processes running a C main program or a program that calls VAXC$CRTL_INIT or DECC$CRTL_INIT are included.

A typical usage of the clock function is to call it after a program does its initial setup, and then again after the program executes the code to be timed. Then subtract the two values to give elapsed CPU time.


Return Values

n The processor time used.
- 1 Indicates that the processor time used is not available.

clock_getres (ALPHA, I64)

Gets the resolution for the specified clock.

Format

#include <time.h>

int clock_getres (clockid_t clock_id, struct timespec *res);


Arguments

clock_id

The clock type used to obtain the resolution. The CLOCK_REALTIME clock is supported and represents the TIME-OF-DAY clock for the system.

res

A pointer to the timespec data structure that receives the value of the clock's resolution.

Description

The clock_getres function obtains the resolution value for the specified clock. Clock resolutions are implementation-dependent and cannot be set by a process.

If the res argument is not NULL, the resolution of the specified clock is stored in the location pointed to by res.

If res is NULL, the clock resolution is not stored.

If the time argument (tp) of clock_settime is not a multiple of res, then the value is truncated to a multiple of res.

On success, the function returns 0.

On failure, the function returns - 1 and sets errno to indicate the error.

See also clock_gettime , clock_settime , time , and ctime .


Return Values

0 Indicates success.
- 1 Indicates failure; errno is set to the following value:
  • EINVAL -- The clock_id argument does not specify a known clock.

clock_gettime (ALPHA, I64)

Returns the current time (in seconds and nanoseconds) for the specified clock.

Format

#include <time.h>

int clock_gettime (clockid_t clock_id, struct timespec *tp);


Arguments

clock_id

The clock type used to obtain the time for the clock that is set. The CLOCK_REALTIME clock is supported and represents the TIME-OF-DAY clock for the system.

tp

A pointer to a timespec data structure.

Description

The clock_gettime function returns the current tp value for the specified clock, clock_id.

On success, the function returns 0.

On failure, the function returns - 1 and sets errno to indicate the error.

See also clock_getres , clock_settime , time , and ctime .


Return Values

0 Indicates success.
- 1 Indicates failure; errno is set to the following value:
  • EINVAL -- The clock_id argument does not specify a known clock, or the tp argument specifies a nanosecond value less than 0 or greater than or equal to 1 billion.

clock_settime (ALPHA, I64)

Sets the specified clock.

Format

#include <time.h>

int clock_settime (clockid_t clock_id, const struct timespec *tp);


Arguments

clock_id

The clock type used for the clock that is to be set. The CLOCK_REALTIME clock is supported and represents the TIME-OF-DAY clock for the system.

tp

A pointer to a timespec data structure.

Description

The clock_settime function sets the specified clock, clock_id, to the value specified by tp. Time values that are between two consecutive non-negative integer multiples of the resolution of the specified clock are truncated down to the smaller multiple of the resolution.

A clock can be systemwide (that is, visible to all processes) or per-process (measuring time that is meaningful only within a process).

The CLOCK_REALTIME clock, defined in <time.h> , represents the realtime clock for the system. For this clock, the values specified by clock_settime and returned by clock_gettime represent the amount of time elapsed, in seconds and nanoseconds, since the Epoch. The Epoch is defined as 00:00:00:00 January 1, 1970 Greenwich Mean Time (GMT).

You must have OPER, LOG_IO, and SYSPRV privileges to use the clock_settime function.

On success, the function returns 0.

On failure, the function returns - 1 and sets errno to indicate the error.

See also clock_getres , clock_gettime , time , and ctime .


Return Values

0 Indicates success.
- 1 Indicates failure; errno is set to the following value:
  • EINVAL -- The clock_id argument does not specify a known clock, or the tp argument is outside the range for the given clock_id or specifies a nanosecond value less than 0 or greater than or equal to 1 billion.
  • EPERM -- The requesting process does not have the appropriate privilege to set the specified clock.

clog (ALPHA, I64)

Returns the complex natural (base e) logarithm of its argument.

Format

#include <complex.h>

double complex clog (double complex z);

float complex clogf (float complex z);

long double complex clogl (long double complex z);


Argument

z

A complex value.

Description

The clog functions return the complex natural (base e) logarithm of z, with a branch cut along the negative real axis.

Return Values

x The complex natural logarithm value in the range of a strip mathematically unbounded along the real axis and in the interval [-i&#960;, +i&#960;] along the imaginary axis.


Previous Next Contents Index