/* xdigit character class */ if ((iswxdigit((wint_t) w_char)) && (iswctype((wint_t) w_char, wctype("xdigit")))) printf("[%C] is a member of the character class xdigit\n", w_char); else printf("[%C] is not a member of the character class xdigit\n", w_char); } Running this example produces the following result: [A] is a member of the character class alnum [A] is a member of the character class alpha [A] is not a member of the character class cntrl [A] is not a member of the character class digit [A] is a member of the character class graph [A] is not a member of the character class lower [A] is a member of the character class print [A] is not a member of the character class punct [A] is not a member of the character class space [A] is a member of the character class upper [A] is a member of the character class xdigit 2 wcwidth Determines the number of printing positions on a display device required for the specified wide character. Format #include int wcwidth (wchar_t wc); 3 Argument wc A wide character. 3 Description The wcwidth function determines the number of column positions needed for the specified wide character wc. The value of wc must be a valid wide character in the current locale. 3 Return_Values x The number of printing positions required for wc. 0 If wc is a null character. -1 Indicates that wc does not represent a valid printing wide character. 2 wmemchr Locates the first occurrence of a specified wide character in an array of wide characters. Format #include wchar_t wmemchr (const wchar_t *s, wchar_t c, size_t n); 3 Function_Variants The wmemchr function has variants named _wmemchr32 and _wmemchr64 for use with 32-bit and 64-bit pointer sizes, respectively. 3 Arguments s A pointer to an array of wide characters to be searched. c The wide character value to search for. n The maximum number of wide characters in the array to be searched. 3 Description The wmemchr function locates the first occurrence of the specified wide character in the initial n wide characters of the array pointed to by s. 3 Return_Values x A pointer to the first occurrence of the wide character in the array. NULL The specified wide character does not occur in the array. 2 wmemcmp Compares two arrays of wide characters. Format #include int wmemcmp (const wchar_t *s1, const wchar_t *s2, size_t n); 3 Arguments s1, s2 Pointers to wide-character arrays. n The maximum number of wide characters to be compared. 3 Description The wmemcmp function compares the first n wide characters of the array pointed to by s1 with the first n wide characters of the array pointed to by s2. The wide characters are compared not according to locale-dependent collation rules, but as integral objects of type wchar_t. 3 Return_Values 0 Arrays are equal. Positive value The first array is greater than the second. Negative value The first array is less than the second. 2 wmemcpy Copies a specified number of wide characters from one wide- character array to another. Format #include wchar_t wmemcpy (wchar_t *dest, const wchar_t *source, size_t n); 3 Function_Variants The wmemcpy function has variants named _wmemcpy32 and _wmemcpy64 for use with 32-bit and 64-bit pointer sizes, respectively. 3 Arguments dest A pointer to the destination array. source A pointer to the source array. n The number of wide characters to be copied. 3 Description The wmemcpy function copies n wide characters from the array pointed to by source to the array pointed to by dest. 3 Return_Value x The value of dest. 2 wmemmove Copies a specified number of wide characters from one wide- character array to another. Format #include wchar_t wmemmove (wchar_t *dest, const wchar_t *source, size_t n); 3 Function_Variants The wmemmove function has variants named _wmemmove32 and _wmemmove64 for use with 32-bit and 64-bit pointer sizes, respectively. 3 Arguments dest A pointer to the destination array. source A pointer to the source array. n The number of wide characters to be moved. 3 Description The wmemmove function copies n wide characters from the location pointed to by source to the location pointed to by dest. The wmemmove and wmemcpy routines perform the same function, except that wmemmove ensures that the original contents of the source array are copied to the destination array even if the two arrays overlap. Where such overlap is possible, programs that require portability should use wmemmove, not wmemcopy. 3 Return_Value x The value of dest. 2 wmemset Sets a specified value to a specified number of wide characters in an array of wide characters. Format #include wchar_t wmemset (wchar_t *s, wchar_t c, size_t n); 3 Function_Variants The wmemset function has variants named _wmemset32 and _wmemset64 for use with 32-bit and 64-bit pointer sizes, respectively. 3 Arguments s A pointer to the array of wide characters. c The value to be placed in the first n wide characters of the array. n The number of wide characters to be set to the specified value c. 3 Description The wmemset function copies the value of c into each of the first n wide characters of the array pointed to by s. 3 Return_Value x The value of s. 2 wprintf Performs formatted output from the standard output (stdout). See Chapter 2 for information on format specifiers. Format #include int wprintf (const wchar_t *format, . . . ); 3 Arguments format A pointer to a wide-character string containing the format specifications. . . . Optional expressions whose resultant types correspond to conversion specifications given in the format specification. If no conversion specifications are given, the output sources can be omitted. 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. Excess output pointers, if any, are ignored. 3 Description The wprintf function is equivalent to the fwprintf function with the stdout argument interposed before the wprintf arguments. 3 Return_Values n The number of wide characters written. Negative value Indicates an error. The function sets errno to one of the following: o EILSEQ - Invalid character detected. o EINVAL - Insufficient arguments. o ENOMEM - Not enough memory available for conversion. o ERANGE - Floating-point calculations overflow. o EVMSERR - Nontranslatable OpenVMS error. vaxc$errno contains the OpenVMS error code. This might indicate that conversion to a numeric value failed because of overflow. The function can also set errno to the following as a result of errors returned from the I/O subsystem: o EBADF - The file descriptor is not valid. o EIO - I/O error. o ENOSPC - No free space on the device containing the file. o ENXIO - Device does not exist. o EPIPE - Broken pipe. o ESPIPE - Illegal seek in a file opened for append. o EVMSERR - Nontranslatable OpenVMS error. vaxc$errno contains the OpenVMS error code. This indicates that an I/O error occurred for which there is no equivalent C error code. 2 wrapok 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 routine is provided only for UNIX software compatibility and serves no function in the OpenVMS environment. Format #include wrapok (WINDOW *win, bool boolf); 3 Arguments win A pointer to the window. boolf A Boolean TRUE or FALSE value. If boolf is FALSE, scrolling is not allowed. This is the default setting. The bool type is defined in the header file as follows: #define bool int 2 write Writes a specified number of bytes from a buffer to a file. Format #include ssize_t write (int file_desc, void *buffer, size_t nbytes); (ISO POSIX-1) int write (int file_desc, void *buffer, int nbytes); (Compatibility) 3 Arguments file_desc A file descriptor that refers to a file currently opened for writing or updating. buffer The address of contiguous storage from which the output data is taken. nbytes The maximum number of bytes involved in the write operation. 3 Description If the write is to an RMS record file and the buffer contains embedded new-line characters, more than one record may be written to the file. Even if there are no embedded new-line characters, if nbytes is greater than the maximum record size for the file, more than one record will be written to the file. The write function always generates at least one record. If the write is to a mailbox and the third argument, nbytes, specifies a length of 0, an end-of-file message is written to the mailbox. This occurs for mailboxes created by the application using SYS$CREMBX, but not for mailboxes created to implement POSIX pipes. For more information see the "Subprocess Functions" chapter of the VSI C RTL Reference Manual. 3 Return_Values x The number of bytes written. -1 Indicates errors, including undefined file descriptors, illegal buffer addresses, and physical I/O errors. 2 writev Writes to a file. Format #include ssize_t writev (int file_desc, const struct iovec *iov, int iovcnt); ssize_t __writev64 (int file_desc, const struct __iovec64 *iov, int iovcnt); (Integrity servers, Alpha) 3 Function_Variants The writev function has variants named _writev32 and __writev64 for use with 32-bit and 64-bit pointer sizes, respectively. 3 Arguments file_desc A file descriptor that refers to a file currently opened for writing or updating. iov Array of iovec structures from which the output data is gathered. iovcnt The number of buffers specified by the members of the iov array. 3 Description The writev function is equivalent to write but gathers the output data from the iovcnt buffers specified by the members of the iov array: iov[0], iov[1], ..., iov[iovcnt-1]. The iovcnt argument is valid if greater than 0 and less than or equal to {IOV_MAX}, defined in . Each iovec entry specifies the base address and length of an area in memory from which data should be written. The writev function writes a complete area before proceeding to the next. If filedes refers to a regular file and all of the iov_len members in the array pointed to by iov are 0, writev returns 0 and has no other effect. For other file types, the behavior is unspecified. If the sum of the iov_len values is greater than SSIZE_MAX, the operation fails and no data is transferred. Upon successful completion, writev returns the number of bytes actually written. Otherwise, it returns a value of -1, the file pointer remains unchanged, and errno is set to indicate an error. 3 Return_Values x The number of bytes written. -1 Indicates an error. The file times do not change, and the function sets errno to one of the following values: o EBADF - The file_desc argument is not a valid file descriptor open for writing. o EINTR - The write operation was terminated due to the receipt of a signal, and no data was transferred. o EINVAL - The sum of the iov_len values in the iov array would overflow an ssize_t, or the iovcnt argument was less than or equal to 0, or greater than {IOV_MAX}. o EIO - A physical I/O error has occurred. o ENOSPC - There was no free space remaining on the device containing the file. o EPIPE - An attempt is made to write to a pipe or FIFO that is not open for reading by any process, or that only has one end open. A SIGPIPE signal will also be sent to the thread. 2 wscanf Reads input from the standard input (stdin) under control of the wide-character format string. Format #include int wscanf (const wchar_t *format, . . . ); 3 Arguments format A pointer to a wide-character string containing the format specifications. . . . Optional expressions whose results correspond to conversion specifications given in the format specification. 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. Excess input pointers, if any, are ignored. 3 Description The wscanf function is equivalent to the fwscanf function with the stdin arguments interposed before the wscanf arguments. 3 Return_Values n The number of input items assigned. The number can be less than provided for, even zero, in the event of an early matching failure. EOF Indicates an error. An input failure occurred before any conversion. 2 y0,y1,yn Compute Bessel functions of the second kind. This function is supported on OpenVMS Integrity servers and Alpha only. Format #include double y0 (double x); float y0f (float x); long double y0l (long double x); double y1 (double x); float y1f (float x); long double y1l (long double x); double yn (int n, double x); float ynf (int n, float x); long double ynl (int n, long double x); 3 Arguments x A positive, real value. n An integer. 3 Description The y0 functions return the value of the Bessel function of the second kind of order 0. The y1 functions return the value of the Bessel function of the second kind of order 1. The yn functions return the value of the Bessel function of the second kind of order n. 3 Return_Values x The relevant Bessel value of x of the second kind. -HUGE_VAL The x argument is 0.0; errno is set to ERANGE. NaN The x argument is negative or NaN; errno is set to EDOM. 0 Underflow occurred; errno is set to ERANGE. HUGE_VAL Overflow occurred; errno is set to ERANGE. 2 Version-Dependency_Tables New functions are added to the VSI C Run-Time Library with each version of VSI C. These functions are implemented and shipped with the OpenVMS operating system, while the documentation and header files containing their prototypes are shipped with versions of the VSI C compiler. You might have a newer version of VSI C that has header files and documentation for C RTL 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 C RTL functions introduced on OpenVMS Version 7.3, even though they are documented in this manual. The following tables list what C RTL functions are supported on recent OpenVMS versions. This is helpful for determining the functions to avoid using on your target OpenVMS platforms. 3 All_OpenVMS_Versions The following functions are available on all OpenVMS VAX, Alpha, and Integrity servers versions: abort abs access acos alarm asctime asin assert atan2 atan atexit atof atoi atoll (Alpha) atol atoq (Alpha) box brk bsearch cabs calloc ceil cfree chdir chmod chown clearerr clock close cosh cos creat ctermid ctime cuserid decc$crtl_init decc$fix_time decc$from_vms decc$match_wild decc$record_read decc$record_write decc$set_reentrancy decc$to_vms decc$translate_vms delete delwin difftime div dup2 dup ecvt endwin execle execlp execl execve execvp execv exit _exit exp fabs fclose fcvt fdopen feof ferror fflush fgetc fgetname fgetpos fgets fileno floor fmod fopen fprintf fputc fputs fread free freopen frexp fscanf fseek fsetpos fstat fsync ftell ftime fwait fwrite gcvt getchar getcwd getc getegid getenv geteuid getgid getname getpid getppid gets getuid getw gmtime gsignal hypot initscr isalnum isalpha isapipe isascii isatty iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit kill labs ldexp ldiv llabs (Alpha) lldiv(Alpha) localeconv localtime log10 log longjmp longname lseek lwait malloc mblen mbstowcs mbtowc memchr memcmp memcpy memmove memset mkdir mktemp mktime modf mvwin mv[w]addstr newwin nice open overlay overwrite pause perror pipe pow printf putchar putc puts putw qabs (Alpha) qdiv (Alpha) qsort raise rand read realloc remove rename rewind sbrk scanf scroll setbuf setgid setjmp setlocale setuid setvbuf sigblock signal sigpause sigstack(VAX) sigvec sinh sin sleep sprintf sqrt srand sscanf ssignal stat strcat strchr strcmp strcoll strcpy strcspn strerror strftime strlen strncat strncmp strncpy strpbrk strrchr strspn strstr strtod strtok strtoll strtol (Alpha) strtoq (Alpha) strtoull (Alpha) strtoul strtouq (Alpha) strxfrm subwin system tanh tan times time tmpfile tmpnam toascii tolower _tolower touchwin toupper _toupper ttyname umask ungetc vaxc$calloc_opt vaxc$cfree_opt vaxc$crtl_init vaxc$establish vaxc$free_opt vaxc$malloc_opt vaxc$realloc_opt va_arg va_count va_end va_start va_start_1 vfork vfprintf vprintf vsprintf wait wcstombs wctomb write [w]addch [w]addstr [w]clear [w]clrattr [w]clrtobot [w]clrtoeol [w]delch [w]deleteln [w]erase [w]getch [w]getstr [w]inch [w]insch [w]insertln [w]insstr [w]move [w]printw [w]refresh [w]scanw [w]setattr [w]standend [w]standout 3 V6.2_and_Higher The following additional functions are available on OpenVMS VAX and OpenVMS Alpha Version 6.2 and higher: catclose catgets catopen fgetwc fgetws fputwc fputws getopt getwc getwchar iconv iconv_close iconv_open iswalnum iswalpha iswcntrl iswctype iswdigit iswgraph iswlower iswprint iswpunct iswspace iswupper iswxdigit nl_langinfo putwc putwchar strnlen strptime towlower towupper ungetwc wcscat wcschr wcscmp wcscoll wcscpy wcscspn wcsftime wcslen wcsncat wcsncmp wcsncpy wcspbrk wcsrchr wcsspn wcstol wcstoul wcswcs wcswidth wcsxfrm wcstod wctype wcwidth wcstok 3 V7.0_and_Higher The following additional functions are available on OpenVMS VAX and OpenVMS Alpha Version 7.0 and higher: basename bcmp bcopy btowc bzero closedir confstr dirname drand48 erand48 ffs fpathconf ftruncate ftw fwide fwprintf fwscanf getclock getdtablesizegetitimer getlogin getpagesize getpwnam getpwuid gettimeofday index initstate jrand48 lcong48 lrand48 mbrlen mbrtowc mbsinit mbsrtowcs memccpy mkstemp mmap mprotect mrand48 msync munmap nrand48 opendir pathconf pclose popen putenv random readdir rewinddir rindex rmdir seed48 seekdir setenv setitimer setstate sigaction sigaddset sigdelset sigemptyset sigfillset sigismember siglongjmp sigpending sigprocmask sigsetjmp sigsuspend srand48 srandom strcasecmp strdup strfmon strncasecmp strsep swab swprintf swscanf sysconf telldir tempnam towctrans truncate tzset ualarm uname unlink unsetenv usleep vfwprintf vswprintf vwprintf wait3 wait4 waitpid wcrtomb wcsrtombs wcsstr wctob wctrans wmemchr wmemcmp wmemcpy wmemmove wmemset wprintf wscanf 3 V7.0_Alpha_and_Higher The following additional functions are available on OpenVMS Alpha Version 7.0 and higher: _basename32 _basename64 _bsearch32 _bsearch64 _calloc32 _calloc64 _catgets32 _catgets64 _ctermid32 _ctermid64 _cuserid32 _cuserid64 _dirname32 _dirname64 _fgetname32 _fgetname64 _fgets32 _fgets64 _fgetws32 _fgetws64 _gcvt32 _gcvt64 _getcwd32 _getcwd64 _getname32 _getname64 _gets32 _gets64 _index32 _index64 _longname32 _longname64 _malloc32 _malloc64 _mbsrtowcs32 _mbsrtowcs64 _memccpy32 _memccpy64 _memchr32 _memchr64 _memcpy32 _memcpy64 _memmove32 _memmove64 _memset32 _memset64 _mktemp32 _mktemp64 _mmap32 _mmap64 _qsort32 _qsort64 _realloc32 _realloc64 _rindex32 _rindex64 _strcat32 _strcat64 _strchr32 _strchr64 _strcpy32 _strcpy64 _strdup32 _strdup64 _strncat32 _strncat64 _strncpy32 _strncpy64 _strpbrk32 _strpbrk64 _strptime32 _strptime64 _strrchr32 _strrchr64 _strsep32 _strsep64 _strstr32 _strstr64 _strtod32 _strtod64 _strtok32 _strtok64 _strtol32 _strtol64 _strtoll32 _strtoll64 _strtoq32 _strtoq64 _strtoul32 _strtoul64 _strtoull32 _strtoull64 _strtouq32 _strtouq64 _tmpnam32 _tmpnam64 _wcscat32 _wcscat64 _wcschr32 _wcschr64 _wcscpy32 _wcscpy64 _wcsncat32 _wcsncat64 _wcsncpy32 _wcsncpy64 _wcspbrk32 _wcspbrk64 _wcsrchr32 _wcsrchr64 _wcsrtombs32 _wcsrtombs64 _wcsstr32 _wcsstr64 _wcstok32 _wcstok64 _wcstol32 _wcstol64 _wcstoul32 _wcstoul64 _wcswcs32 _wcswcs64 _wmemchr32 _wmemchr64 _wmemcpy32 _wmemcpy64 _wmemmove32 _wmemmove64 _wmemset32 _wmemset64 3 V7.2_and_Higher The following additional functions are available on OpenVMS VAX and OpenVMS Alpha Version 7.2 and higher: asctime_r ctime_r decc$set_child_standard_streams decc$write_eof_to_mbx decc$validated lclose dlerror dlopen dlsym fcntl gmtime_r localtime_r wchar 3 V7.3_and_Higher The following additional functions are available on OpenVMS VAX and OpenVMS Alpha Version 7.3 and higher: fchown link utime utimes writev 3 V7.3-1_and_Higher The following additional functions are available on OpenVMS Alpha Version 7.3-1 and higher: access fseeko chmod ftello chown ftw fstat readdir_r stat vfscanf vfwscanf vscanf vwscanf vsscanf vswscanf decc$feature_get_index decc$feature_get_name decc$feature_get_value decc$feature_set_value 3 V7.3-2_and_Higher The following additional functions are available on OpenVMS Alpha Version 7.3-2 and higher: a64l clock_getres clock_gettime clock_settime endgrent getgrent getgrgid getgrgid_r getgrnam getgrnam_r getpgid getpgrp _getpwnam64 getpwnam_r _getpwnam_r64 _getpwent64 getpwuid _getpwuid64 getpwuid_r _getpwuid_r64 getsid l64a nanosleep poll pread pwrite rand_r readv _readv64 seteuid setgrent setpgid setpgrp setregid setreuid setsid sighold sigignore sigrelse sigtimedwait sigwait sigwaitinfo snprintf ttyname_r vsnprintf __writev64 decc$set_child_default_dir 3 V8.2_and_Higher The following additional functions are available on OpenVMS Alpha and Integrity servers Version 8.2 and higher: clearerr_unlocked feof_unlocked ferror_unlocked fgetc_unlocked fputc_unlocked flockfile ftrylockfile funlockfile getc_unlocked getchar_unlocked putc_unlocked putchar_unlocked statvfs fstatvfs _glob32 _glob64 _globfree32 _globfree64 socketpair 3 V8.3_and_Higher The following additional functions are available on OpenVMS Alpha and Integrity servers Version 8.3 and higher: crypt fchmod encrypt lstat setkey readlink lchown symlink realpath unlink 3 V8.4_and_Higher The following additional functions are available on OpenVMS Alpha and Integrity servers Version 8.4 and higher: ftok sem_init semctl sem_open semget sem_post semop sem_timedwait sem_close sem_trywait sem_destroy sem_unlink sem_getvalue sem_wait 2 Prototypes_Duplicated_to_Nonstandard_Headers The various standards dictate which header file must define each of the standard functions. This is the included header file documented with each function prototype in the Reference Section of this manual. However, many of the functions defined by the standards already existed on several operating systems and were defined in different header files. This is especially true on OpenVMS systems with the header files , , and . So, to provide upward compatibility for these functions, their prototypes are duplicated in both the expected header file as well as the header file defined by the standards. Duplicated Prototypes lists these functions. Table B-1 Duplicated Prototypes Duplicated Function in Standard says access alarm bcmp bcopy bzero chdir chmod chown close creat ctermid cuserid dirname dup dup2 ecvt execl execle execlp execv execve execvp _exit fcvt ffs fsync ftime gcvt getcwd getegid getenv geteuid getgid getopt getpid getppid getuid index isatty lseek mkdir mktemp nice open pause pipe read rindex sbrk setgid setuid sleep strcasecmp strncasecmp system times umask vfork wait write