Order Number: BA554-90014
This manual describes the functions and macros in the HP C Run-Time Library for OpenVMS systems.
Revision/Update Information: This manual supersedes the HP C Run-Time Library Reference Manual for OpenVMS Systems, Version 8.3
OpenVMS Version 8.4 for Integrity servers
OpenVMS Alpha Version 8.4
Palo Alto, California
© Copyright 2010 Hewlett-Packard Development Company, L.P.
Confidential computer software. Valid license from HP required for possession, use or copying. Consistent with FAR 12.211 and 12.212, Commercial Computer Software, Computer Software Documentation, and Technical Data for Commercial Items are licensed to the U.S. Government under vendor's standard commercial license.
The information contained herein is subject to change without notice. The only warranties for HP products and services are set forth in the express warranty statements accompanying such products and services. Nothing herein should be construed as constituting an additional warranty. HP shall not be liable for technical or editorial errors or omissions contained herein.
UNIX is a registered trademark of The Open Group.
X/Open is a registered trademark of X/Open Company Ltd. in the UK and other countries.
Intel and Itanium are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries.
Printed in the US
ZK5763The HP OpenVMS documentation set is available on CD-ROM.
This document was prepared using DECdocument, Version V3.3-1e.
Portions of the HP C Run-Time Library have been implemented using source copyrighted by the University of California, Berkley and its contributors.
Copyright (c) 1981 Regents of the University of California.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This manual describes the HP C Run-Time Library (RTL) for the OpenVMS operating system on Integrity servers and Alpha. HP OpenVMS Industry Standard 64 for Integrity servers is the full product name of the OpenVMS operating system on Intel Itanium processors.
This manual provides reference information about the C RTL functions and macros that perform input/output (I/O) operations, character and string manipulation, mathematical operations, error detection, subprocess creation, system access, screen management, and emulation of selected UNIX features. It also notes portability concerns between operating systems, where applicable.
The HP C RTL contains XPG4-compliant internationalization support, providing functions to help you develop software that can run in different languages and cultures.
The complete HP C Run-Time Library (C RTL) needed for use with the HP C and C++ compilers is distributed with the OpenVMS Alpha and OpenVMS Integrity server operating systems in both shared image and object module library form.
This manual no longer documents the socket routines used for writing Internet application programs for the TCP/IP Services protocol. For help on the socket routines, use the following:
$ HELP TCPIP_Services Programming_Interfaces Sockets_API
Also see the HP TCP/IP Services for OpenVMS product documentation.
This manual is intended for experienced and novice programmers who need reference information on the functions and macros found in the HP C RTL.
This manual has the following chapters, reference section, and appendixes:
The following documents may be useful when programming in HP C for OpenVMS Systems:
For more information about HP OpenVMS products and services, see:
HP welcomes your comments on this manual. Please send your comments or suggestions to:
For information about how to order additional documentation, see:
|OpenVMS Integrity servers||The variant of the OpenVMS operating system that runs on the Intel Itanium architecture.|
|OpenVMS systems||Refers to the OpenVMS operating system on all supported platforms, unless otherwise specified.|
|[Return]||The symbol [Return] represents a single stroke of the Return key on a terminal.|
|Ctrl/X||The symbol Ctrl/X, where letter X represents a terminal control character, is generated by holding down the Ctrl key while pressing the key of the specified terminal character.|
int data type
<stdio.h> header file
|Monospace type identifies language keywords and the names of HP C functions and header files. Monospace type is also used when referring to a specific variable name used in an example.|
|arg1||Italic type indicates a placeholder, such as an argument or parameter name, and the introduction of new terms.|
|$ RUN CPROG [Return]||Interactive examples show user input in boldface type.|
x = 5;
|A vertical ellipsis indicates that not all of the text of a program or program output is illustrated. Only relevant material is shown in the example.|
|option,...||A horizontal ellipsis indicates that additional parameters, options, or values can be entered. A comma that precedes the ellipsis indicates that successive items must be separated by commas.|
|[output-source,...]||Square brackets, in function synopses and a few other contexts, indicate that a syntactic element is optional. Square brackets are not optional, however, when used to delimit a directory name in an OpenVMS file specification or when used to delimit the dimensions of a multidimensional array in HP C source code.|
|In syntax definitions, items appearing on separate lines are mutually exclusive alternatives.|
|[a|b]||Brackets surrounding two or more items separated by a vertical bar (|) indicate a choice; you must choose one of the two syntactic elements.|
|∆||A delta symbol is used in some contexts to indicate a single ASCII space character.|
A platform is a combination of operating system and hardware that provides a distinct environment. This manual contains information applicable to the OpenVMS operating system running on VAX, Alpha, and Itanium processors.
The information in this manual applies to all of these processors, except when specifically labeled as follows:
|(ALPHA ONLY)||Specific to an Alpha processor.|
|(INTEGRITY SERVERS ONLY)||Specific to an Intel Itanium processor running the OpenVMS operating system. On this platform, the product name of the operating system is OpenVMS Integrity servers.|
|(INTEGRITY SERVERS, ALPHA)||Specific to Integrity servers and Alpha processors.|
The following sections describe the C Run-Time Library (C RTL) enhancements included in OpenVMS Version 8.4. These enhancements provide improved UNIX portability, standards compliance, and the flexibility of additional user-controlled feature selections. New C RTL functions are also included.
The C RTL now supports Unicode, UTF-8 encoding for filenames given in UNIX style. For example, the following filename is now allowed:
This greatly enhances the UNIX portability of International software that uses UTF-8 encoded filenames.
A new logical, DECC$FILENAME_ENCODING_UTF8, is provided to enable this feature.
With this logical undefined, the default behavior is to accept filenames as ASCII and Latin-1 format.
This feature works only on ODS-5 disks. To ENABLE this feature ensure that you must define both the DECC$FILENAME_ENCODING_UTF8 and DECC$EFS_CHARSET logicals.
C RTL supports the following Open Group semaphore control operations in the C RTL:
System V semaphore routines supported:
semctl() semget() semop() ftok()
POSIX semaphore routines supported:
sem_close() sem_destroy() sem_getvalue() sem_init() sem_open() sem_post() sem_timedwait() sem_trywait() sem_unlink() sem_wait()
Applicable to all semaphore routines
When the semaphore APIs, semget and sem_open returns an error status value of 28, which indicates 'no space left on device', you may want to increase the GBLSECTIONS SYSGEN parameter. Semaphores internally use global sections and having huge number of semaphore sets on a system may result in exhaustion of GBLSECTIONS. As a result, the SYSGEN parameter needs to be increased.
Following are the limitations in System V semaphores:
A new feature switch, DECC$PRINTF_USES_VAX_ROUND, has been added to the C RTL.
With this switch set, the F and E format specifiers of printf use VAX rounding rules for programs compiled with IEEE float.
OpenVMS Version 8.3
Enhancements have been made to the Open Group-compliant symbolic-link support and POSIX-compliant pathname support provided in OpenVMS Version 8.3.
These enhancements include: