United States |
Previous | Contents | Index |
Passes a given string to the host environment to be executed by a command processor. This function is nonreentrant.
#include <stdlib.h>int system (const char *string);
string
A pointer to the string to be executed. If string is NULL, a nonzero value is returned. The string is a DCL command, not the name of an image. To execute an image, use one of the exec routines.
This function spawns a subprocess and executes the command specified by string in that subprocess. The system function waits for the subprocess to complete before returning the subprocess status as the return value of the function.The subprocess is spawned within the system call by a call to vfork . Because of this, a call to system should not be made after a call to vfork and before the corresponding call to an exec function.
For OpenVMS Version 7.0 and higher systems, if you include <stdlib.h> and compile with the _POSIX_EXIT feature-test macro set, then the system function returns the status as if it called waitpid to wait for the child. Therefore, use the WIFEXITED and WEXITSTATUS macros to retrieve the exit status in the range of 0 to 255.
You set the _POSIX_EXIT feature-test macro by using /DEFINE=_POSIX_EXIT or #define _POSIX_EXIT at the top of your file, before any file inclusions.
nonzero value If string is NULL, a value of 1 is returned, indicating that the system function is supported. If string is not NULL, the value is the subprocess OpenVMS return status.
#include <stdlib.h> #include <stdio.h> #include <unistd.h> /* write, close */ #include <fcntl.h> /* Creat */ main() { int status, fd; /* Creat a file we are sure is there */ fd = creat("system.test", 0); write(fd, "this is an example of using system", 34); close(fd); if (system(NULL)) { status = system("DIR/NOHEAD/NOTRAIL/SIZE SYSTEM.TEST"); printf("system status = %d\n", status); } else printf("system() not supported.\n"); }
Running this example program produces the following result:
DISK3$:[JONES.CRTL.2059.SRC]SYSTEM.TEST;1 1 system status = 1 |
Returns a double value that is the tangent of its radian argument.
#include <math.h>double tan (double x);
x
A radian expressed as a real number.
n tan( x) HUGE_VAL If x is a singular point (...--3Pi sign/2, --Pi sign/2, Pi sign/2...)
Returns a double value that is the hyperbolic tangent of its double argument.
#include <math.h>double tanh (double x);
x
A real number.
n The hyperbolic tangent of the argument. HUGE_VAL Indicates that the argument is too large; errno is set to ERANGE.
Returns the current location associated with a specified directory stream. Performs operations on directories.
#include <dirent.h>long int telldir (DIR *dir_pointer);
dir_pointer
A pointer to the DIR structure of an open directory.
This function returns the current location associated with the specified directory stream.
x The current location. --1 Indicates an error and is further specified in the global errno .
Constructs the name for a temporary file.
#include <stdio.h>char *tempnam (const char *directory, const char *prefix);
directory
A pointer to the pathname of the directory where you want to create a file.prefix
A pointer to an initial character sequence of the filename. The prefix argument can be null, or it can point to a string of up to five characters used as the first characters of the temporary filename.
This function generates filenames for temporary files. It allows you to control the choice of a directory.If the directory argument is null or points to a string that is not a pathname for an appropriate directory, the pathname defined as P_tmpdir in the < stdio.h > header file is used.
You can bypass the selection of a pathname by providing the TMPDIR environment variable in the user environment. The value of the TMPDIR variable is a pathname for the desired temporary file directory.
Use the prefix argument to specify a prefix of up to 5 characters for the temporary filename.
The tempnam function returns a pointer to the generated pathname, suitable for use in a subsequent call to the free function. See also free in this section.
Note
In contrast to tmpnam , tempnam does not have to generate a different file name on each call. tempnam generates a new file name only if the file with the specified name exists. If you need a unique filename on each call, use tmpnam instead of tempnam .
x A pointer to the generated pathname, suitable for use in a subsequent call to the free function. NULL An error occurred; errno is set to indicate the error.
Returns the time (expressed as Universal Coordinated Time) elapsed since 00:00:00, January 1, 1970, in seconds.
#include <time.h>Function Variants Compiling with the _DECC_V4_SOURCE and _VMS_V6_SOURCE feature-test macros defined enables a local-time-based entry point to this function that is equivalent to the behavior before OpenVMS Version 7.0.time_t time (time_t *time_location);
time_location
Either NULL or a pointer to the place where the returned time is also stored. The time_t type is defined in the <time.h> header file as follows:
typedef unsigned long int time_t;
x The time elapsed past the epoch. ( time_t )(--1) Indicates an error. If the value of SYS$TIMEZONE_DIFFERENTIAL logical is wrong, the function will fail with errno set to EINVAL.
Passes back the accumulated times of the current process and its terminated child processes.
#include <times.h>clock_t times (struct tms *buffer); (OPENVMS V7.0 AND HIGHER)
void times (tbuffer_t *buffer); (PRE OPENVMS V7.0)
buffer
A pointer to the terminal buffer.
For both process and children times, the structure breaks down the time by user and system time. Since the OpenVMS system does not differentiate between system and user time, all system times are returned as 0. Accumulated CPU times are returned in 10-millisecond units.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.
On OpenVMS Version 7.0 and higher systems, the times function returns the elapsed real time in clock ticks since an arbitrary reference time in the past (for example, system startup time). This reference time does not change from one times function call to another. The return value can overflow the possible range of type clock_t values. When times fails, it returns a value of --1. The Compaq C RTL uses system-boot time as its reference time.
x The elapsed real time in clock ticks since system-boot time. ( clock_t )(--1) Indicates an error.
Creates a temporary file that is opened for update.
#include <stdio.h>FILE *tmpfile (void);
The file exists only for the duration of the process, or until the file is closed and is preserved across calls to vfork .
x The address of a file pointer (defined in the <stdio.h> header file). NULL Indicates an error.
Generates file names that can be safely used for a temporary file.
#include <stdio.h>Function Variants This function also has variants named _tmpnam32 and _tmpnam64 for use with 32-bit and 64-bit pointer sizes, respectively. See Section 1.8 for more information on using pointer-size-specific functions.char *tmpnam (char *name);
name
A character string containing a name to use in place of file-name arguments in functions or macros. Successive calls to tmpnam with a null argument cause the function to overwrite the current name.
x If the name argument is the null pointer value NULL, tmpnam returns the address of an internal storage area. If name is not NULL, then it is considered the address of an area of length L_tmpnam (defined in the <stdio.h> header file). In this case, tmpnam returns the name argument as the result.
Converts its argument, an 8-bit ASCII character, to a 7-bit ASCII character.
#include <ctype.h>int toascii (char character);
character
An object of type char .
x A 7-bit ASCII character.
Converts a character to lowercase.
#include <ctype.h>int tolower (int character);
character
An object of type int representable as an unsigned char or the value of EOF. For any other value, the behavior is undefined.
If the argument represents an uppercase letter, and there is a corresponding lowercase letter, as defined by character type information in the program locale category LC_TYPE, the corresponding lowercase letter is returned.
If the argument is not an uppercase character, it is returned unchanged.
x The lowercase letter corresponding to the argument. Or, the unchanged argument, if it is not an uppercase character.
Converts an uppercase character to lowercase.
#include <ctype.h>int _tolower (int character);
character
This argument must be an uppercase letter.
The _tolower macro is equivalent to the tolower function except that its argument must be an uppercase letter (not lowercase, not EOF).
The _tolower macro should not be used with arguments that contain side-effect operations. For instance, the following example will not return the expected result:
d = _tolower (c++);
x The lowercase letter corresponding to the argument.
Places the most recently edited version of the specified window on the terminal screen.
#include <curses.h>int touchwin (WINDOW *win);
win
A pointer to the window.
This function is normally used only to refresh overlapping windows.
OK Indicates success. ERR Indicates an error.
Converts a character to uppercase.
#include <ctype.h>int toupper (int character);
character
An object of type int representable as an unsigned char or the value of EOF. For any other value, the behavior is undefined.
If the argument represents a lowercase letter, and there is a corresponding uppercase letter, as defined by character type information in the program locale category LC_TYPE, the corresponding uppercase letter is returned.
If the argument is not a lowercase character, it is returned unchanged.
x The uppercase letter corresponding to the argument. Or, the unchanged argument, if the argument is not a lowercase character.
Converts a lowercase character to uppercase.
#include <ctype.h>int _toupper (int character);
character
This argument must be an uppercase letter.
The _toupper macro is equivalent to the toupper function except that its argument must be a lowercase letter (not uppercase, not EOF).
The _toupper macro should not be used with arguments that contain side-effect operations. For instance, the following example will not return the expected result:
d = _toupper (c++);
x The uppercase letter corresponding to the argument.
Maps one wide character to another according to a specified mapping descriptor.
#include <wctype.h>wint_t towctrans (wint_t wc, wctrans_t desc);
wc
The wide character that you want to map.desc
Description of the mapping obtained through a call to the wctrans function.
This function maps the wide character specified in wc, using the mapping described by desc .The current setting of the LC_CTYPE category must be the same as during the call to the wctrans function that returned the value of desc.
x The mapped value of the wc wide character, if this character exists in the mapping described by desc. Otherwise, the value of wc is returned.
Converts the argument, a wide-character code, to lowercase. If the argument is not an uppercase character, it is returned unchanged.
#include <wctype.h> (ISO C)#include <wchar.h> (XPG4)
int towlower (wint_t wc);
wc
An object of type wint_t representable as a valid wide character in the current locale, or the value of WEOF. For any other value, the behavior is undefined.
If the argument is an uppercase wide character, the corresponding lowercase wide character (as defined in the LC_CTYPE category of the locale) is returned, if it exists. If it does not exist, the function returns the input argument unchanged.
Converts the argument, a wide character, to uppercase. If the argument is not a lowercase character, it is returned unchanged.
#include <wctype.h> (ISO C)#include <wchar.h> (XPG4)
int towupper (wint_t wc);
wc
An object of type wint_t representable as a valid wide character in the current locale, or the value of WEOF. For any other value, the behavior is undefined.
If the argument is a lowercase wide character, the corresponing uppercase wide character (as defined in the LC_CTYPE category of the locale) is returned, if it exists. If it does not exist, the function returns the input argument unchanged.
Changes file length to a specified length in bytes.
#include <unistd.h>int truncate (const char *path, off_t length);
path
The name of a file that is to be truncated. This argument must point to a pathname that names a regular file for which the calling process has write permission.length
The new length of the file in bytes.
This function changes the length of a file to the size in bytes specified by the length argument.If the new length is less than the previous length, the function removes all data beyond length bytes from the specified file. All file data between the new End-of-File and the previous End-of-File is discarded.
For stream files, if the new length is greater than the previous length, new file data between the previous End-of-File and the new End-of-File is added, consisting of all zeros. (For record files, it is not possible to extend the file in this manner.)
0 Indicates success. --1 An error occurred; errno is set to indicate the error.
Previous | Next | Contents | Index |
|