DEC C
Run-Time Library Reference Manual for OpenVMS Systems

Order Number: AA-PUNEE-TK

November 1995

This manual describes the functions and macros in the DEC C Run-Time Library for OpenVMS systems.

Revision /Update Information: This revised manual supersedes the DEC C Run-Time Library Reference Manual for OpenVMS Systems (Order No. AA-PUNED- TK).

Software Version: DEC C Version 5.2 for OpenVMS Systems

Digital Equipment Corporation
Maynard, Massachusetts

©Digital Equipment Corporation 1982, 1985, 1987, 1989,…1991, 1992, 1993, 1994, 1995…. All Rights Reserved.

__________________________________________________________________

Portions of the DEC C Run-Time Library have been implemented using source copyrighted by the University of California, Berkley and its contributors.

Contents

Preface

1 Introduction

1.1 Using the DEC C Run-Time Library

1.2 RTL Linking Options on Alpha Systems (Alpha only)

1.2.1 Linking with the Shareable Image

1.2.2 Linking with the Object Libraries

1.2.3 Examples

1.3 RTL Linking Options on VAX Systems (VAX only)

1.3.1 Linking with the DEC C RTL

1.3.1.1 Linking with the DEC C RTL Shareable Images

1.3.1.2 Linking with or Providing Your Own Shareable Images

1.3.1.3 Linking with the DEC C RTL Object Libraries

1.3.1.4 Linking with the DEC C RTL Object Libraries /NOSYSSHR

1.3.2 Resolving Link-Time Conflicts with Multiple C RTLs

1.3.2.1 Using VAXC$LCL.OPT

1.3.2.2 Using VAXC$EMPTY.EXE

1.3.2.3 Using DECC$EMPTY.EXE

1.3.3 Linking Examples for DEC C or DEC C++ Code Only

1.3.4 Linking Examples for VAX C and DEC C Code Combined

1.3.5 Linking with the VAX C RTL /NOSYSSHR

1.4 DEC C RTL Function Prototypes and Syntax

1.4.1 Function Prototypes

1.4.2 Syntax Conventions for Function Prototypes

1.4.3 UNIX Style File Specifications

1.5 Feature-Test Macros for Header-File Control

1.5.1 Standards Macros

1.5.2 Selecting a Standard

1.5.3 Interactions with the /STANDARD Qualifier

1.5.4 Multiple-Version-Support Macro

1.5.5 Compatibility Modes

1.5.6 Curses and Socket Compatibility Macros

1.6 Input and Output on OpenVMS Systems

1.6.1 RMS Record and File Formats

1.6.2 Access to RMS Files

1.6.2.1 Accessing RMS Files in Stream Mode

1.6.2.2 Accessing RMS Record Files in Record Mode

1.6.2.2.1 Accessing Variable-Length or VFC Record Files in Record Mode

1.6.2.2.2 Accessing Fixed-Length Record Files in Record Mode

1.6.2.3 Example-Difference Between Stream Mode and Record Mode

1.7 Specific Portability Concerns

1.7.1 Reentrancy

1.7.2 Multithread Restrictions

1.8 64-bit Pointer Support (Alpha only)

1.8.1 Using the DEC C Run-Time Library

1.8.2 Obtaining 64-bit Pointers to Memory

1.8.3 DEC C Header Files

1.8.4 Functions Affected

1.8.4.1 No Pointer-Size Impact

1.8.4.2 Functions Accepting Both Pointer Sizes

1.8.4.3 Functions with Two Implementations

1.8.4.4 Restricted to 32-Bit Pointers

1.8.5 Reading Header Files

2 Understanding Input and Output

2.1 Using RMS from RTL Routines

2.2 UNIX I/O and Standard I/O

2.3 Wide-Character Versus Byte I/O Functions

2.4 Conversion Specifications

2.4.1 Converting Input Information

2.4.2 Converting Output Information

2.5 Terminal I/O

2.6 Program Examples

3 Character, String, and Argument-List Functions

3.1 Character-Classification Functions

3.2 Character-Conversion Functions

3.3 String and Argument-List Functions

3.4 Program Examples

4 Error and Signal Handling

4.1 Error Handling

4.2 Signal Handling

4.2.1 OpenVMS Versus UNIX Terminology

4.2.2 UNIX Signals and the DEC C RTL

4.2.3 Signal-Handling Concepts

4.2.4 Signal Actions

4.2.5 Signal Handling and OpenVMS Exception Handling

4.3 Program Example

5 Subprocess Functions

5.1 Implementing Child Processes in DEC C

5.2 The exec Functions

5.2.1 Exec Processing

5.2.2 Exec Error Conditions

5.3 Synchronizing Processes

5.4 Interprocess Communication

5.5 Program Examples

6 Curses Screen Management Functions and Macros

6.1 Using the BSD-Based Curses Package (Alpha only)

6.2 Curses Overview

6.3 Curses Terminology

6.3.1 Predefined Windows (stdscr and curscr)

6.3.2 User-Defined Windows

6.4 Getting Started with Curses

6.5 Predefined Variables and Constants

6.6 Cursor Movement

6.7 Program Example

7 Math Functions

7.1 Math Function Variants-float, double, long double

7.2 Error Detection

7.3 The <fp.h> Header File

7.4 Example

8 Memory Allocation Functions

8.1 Program Example

9 System Functions

10 Developing International Software

10.1 Features of International Software

10.2 Developing International Software Using DEC C

10.3 Locales

10.4 Using the setlocale Function to Set Up an International Environment

10.5 Using Message Catalogs

10.6 Handling Different Character Sets

10.6.1 Charmap File

10.6.2 Converter Functions

10.6.3 Using Codeset Converter Files

10.7 Handling Culture-Specific Information

10.7.1 Extracting Cultural Information From a Locale

10.7.2 Date and Time Formatting Functions

10.7.3 Monetary Formatting Function

10.7.4 Numeric Formatting

10.8 Functions for Handling Wide Characters

10.8.1 Character Classification Functions

10.8.2 Case Conversion Functions

10.8.3 Functions for Input and Output of Wide Characters

10.8.4 Functions for Converting Multibyte and Wide Characters

10.8.5 Functions for Manipulating Wide-Character Strings and Arrays

10.9 Collating Functions

11 Date/Time Functions

11.1 Date/Time Support Models

11.2 Overview of Date/Time Functions

11.3 DEC C RTL Date/Time Computations-UTC and Local Time

11.4 Time-Zone Conversion Rule Files

11.5 Sample Date/Time Scenario

Reference Section

abort

abs

access

acos

[w]addch

[w]addstr

alarm

asctime

asin

assert

atan

atan2

atexit

atof

atoi, atol

atoq, atoll (Alpha only)

basename

bcmp

bcopy

box

brk

bsearch

btowc

bzero

cabs

calloc

catclose

catgets

catopen

ceil

cfree

chdir

chmod

chown

[w]clear

clearerr

clearok

clock

close

closedir

[w]clrattr

[w]clrtobot

[w]clrtoeol

confstr

cos

cosh

cot

creat

[no]crmode

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

[w]delch

delete

[w]deleteln

delwin

difftime

dirname

div

drand48

dup, dup2

[no]echo

ecvt

endwin

erand48

[w]erase

execl

execle

execlp

execv

execve

execvp

exit, _exit

exp

fabs

fclose

fcvt

fdopen

feof

ferror

fflush

ffs

fgetc

fgetname

fgetpos

fgets

fgetwc

fgetws

fileno

floor

fmod

fopen

fp_class, fp_classf, fp_classl (Alpha only)

fpathconf

fprintf

fputc

fputs

fputwc

fputws

fread

free

freopen

frexp

fscanf

fseek

fsetpos

fstat

fsync

ftell

ftime

ftruncate

ftw

fwait

fwide

fwrite

fwprintf

fwscanf

gcvt

getc

[w]getch

getchar

getclock

getcwd

getdtablesize

getegid

getenv

geteuid

getgid

getitimer

getlogin

getname

getopt

getpagesize

getpid

getppid

getpwnam

getpwuid

gets

[w]getstr

gettimeofday

getuid

getw

getwc

getwchar

getyx

gmtime

gsignal

hypot

iconv

iconv_close

iconv_open

[w]inch

index

initscr

initstate

[w]insch

[w]insertln

[w]insstr

isalnum

isalpha

isapipe

isascii

isatty

iscntrl

isdigit

isgraph

islower

isprint

ispunct

isspace

isupper

iswalnum

iswalpha

iswcntrl

iswctype

iswdigit

iswgraph

iswlower

iswprint

iswpunct

iswspace

iswupper

iswxdigit

isxdigit

jrand48

kill

labs

lcong48

ldexp

ldiv

leaveok

localeconv

localtime

log, log10

longjmp

longname

lrand48

lseek

lwait

malloc

mblen

mbrlen

mbrtowc

mbstowcs

mbtowc

mbsinit

mbsrtowcs

memccpy

memchr

memcmp

memcpy

memmove

memset

mkdir

mkstemp

mktemp

mktime

mmap

modf

[w]move

mprotect

mrand48

msync

munmap

mv[w]addch

mv[w]addstr

mvcur

mv[w]delch

mv[w]getch

mv[w]getstr

mv[w]inch

mv[w]insch

mv[w]insstr

mvwin

newwin

nice

[no]nl

nl_langinfo

nrand48

open

opendir

overlay

overwrite

pause

pathconf

pclose

perror

pipe

popen

pow

printf

[w]printw

putc

putchar

putenv

puts

putw

putwc

putwchar

qabs, llabs (Alpha only)

qdiv, lldiv (Alpha only)

qsort

raise

rand

random

[no]raw

read

readdir

realloc

[w]refresh

remove

rename

rewind

rewinddir

rindex

rmdir

sbrk

scanf

[w]scanw

scroll

scrollok

seed48

seekdir

[w]setattr

setbuf

setenv

setgid

setitimer

setjmp

setlocale

setstate

setuid

setvbuf

sigaction

sigaddset

sigblock

sigdelset

sigemptyset

sigfillset

sigismember

siglongjmp

sigmask

signal

sigpause

sigpending

sigprocmask

sigsetjmp

sigsetmask

sigstack (VAX only)

sigsuspend

sigvec

sin

sinh

sleep

sprintf

sqrt

srand

srand48

srandom

sscanf

ssignal

[w]standend

[w]standout

stat

strcasecmp

strcat

strchr

strcmp

strcoll

strcpy

strcspn

strdup

strerror

strfmon

strftime

strlen

strncasecmp

strncat

strncmp

strncpy

strnlen

strpbrk

strptime

strrchr

strsep

strspn

strstr

strtod

strtok

strtol

strtoq, strtoll (Alpha only)

strtoul

strtouq, strtoull (Alpha only)

strxfrm

subwin

swab

swprintf

swscanf

sysconf

system

tan

tanh

telldir

tempnam

time

times

tmpfile

tmpnam

toascii

tolower

_tolower

touchwin

toupper

_toupper

towctrans

towlower

towupper

truncate

ttyname

tzset

ualarm

umask

uname

ungetc

ungetwc

unsetenv

usleep

VAXC$CRTL_INIT

VAXC$ESTABLISH

va_arg

va_count

va_end

va_start_1, va_start

vfork

vfprintf

vfwprintf

vprintf

vswprintf

vwprintf

vsprintf

wait

wait3

wait4

waitpid

wcrtomb

wcscat

wcschr

wcscmp

wcscoll

wcscpy

wcscspn

wcsftime

wcslen

wcsncat

wcsncmp

wcsncpy

wcspbrk

wcsrchr

wcsrtombs

wcsspn

wcsstr

wcstod

wcstok

wcstol

wcstombs

wcstoul

wcswcs

wcswidth

wcsxfrm

wctob

wctomb

wctrans

wctype

wcwidth

wmemchr

wmemcmp

wmemcpy

wmemmove

wmemset

wprintf

wrapok

write

wscanf

A DEC C Socket Routine Reference

A.1 Porting Considerations

A.1.1 Calling an IPC Routine from an AST State

A.1.2 Calling from KERNEL or EXEC Modes

A.1.3 Event Flags

A.1.4 Suppressing DEC C Compilation Warnings

A.1.5 Header Files

A.2 DEC C Structures

A.3 Internet Protocols

A.3.1 Transmission Control Protocol

A.3.2 User Datagram Protocol

A.4 errno Values

A.5 h_errno Values

A.6 Relationship Between errno and h_errno

A.7 TCP/IP Interface Enhancements

A.8 Summary of Socket Routines

A.8.1 Basic Communication Routines

A.8.2 Auxiliary Communication Routines

A.8.3 h_errno Support Routines

A.8.4 Communication Support Routines

accept

bind

close

connect

decc$get_sdc

endhostent

endnetent

endprotoent

endservent

gethostaddr

gethostbyaddr

gethostbyname

gethostent

gethostname

getnetbyaddr

getnetbyname

getnetent

getpeername

getprotobyname

getprotobynumber

getprotoent

getservbyname

getservbyport

getservent

getsockname

getsockopt

herror

hstrerror

hostalias

htonl

htons

inet_addr

inet_lnaof

inet_makeaddr

inet_netof

inet_network

inet_ntoa

ioctl

listen

ntohl

ntohs

read

recv

recvfrom

recvmsg

select

send

sendmsg

sendto

sethostent

setnetent

setprotoent

setservent

setsockopt

shutdown

socket

socket_fd

vaxc$get_sdc

write

A.9 Programming Examples

B Version-Dependency Tables

C Prototypes Duplicated to Non-Standard Headers

Index

Examples

1-1 Differences Between Stream Mode and Record Mode

2-1 Output of the Conversion Specifications

2-2 Using the Standard I/O Functions

2-3 Using Wide Character I/O Functions

2-4 I/O Using File Descriptors and Pointers

3-1 Character-Classification Functions

3-2 Converting Double Values to an ASCII String

3-3 Changing Characters to and from Uppercase Letters

3-4 Concatenating Two Strings

3-5 Four Arguments to the strcspn Function

3-6 Using the <stdarg.h> Functions and Definitions

4-1 Suspending and Resuming Programs

5-1 Creating the Child Process

5-2 Passing Arguments to the Child Process

5-3 Checking the Status of Child Processes

5-4 Communicating Through a Pipe

6-1 A Curses Program

6-2 Manipulating Windows

6-3 Refreshing the Terminal Screen

6-4 Curses Predefined Variables

6-5 The Cursor Movement Functions

6-6 stdscr and Occluding Windows

7-1 Calculating and Verifying a Tangent Value

8-1 Allocating and Deallocating Memory for Structures

9-1 Accessing the User Name

9-2 Accessing Terminal Information

9-3 Manipulating the Default Directory

9-4 Printing the Date and Time

A-1 TCP/IP Server

A-2 TCP/IP Client

A-3 UDP/IP Server

A-4 UDP/IP Client

Figures

1-1 Linking with the DEC C RTL on OpenVMS Alpha Systems

1-2 I/O Interface from C Programs

1-3 Mapping Standard I/O and UNIX I/O to RMS

5-1 Communications Links Between Parent and Child Processes

6-1 An Example of the stdscr Window

6-2 Displaying Windows and Subwindows

6-3 Updating the Terminal Screen

6-4 An Example of the getch Macro

1 Reading and Writing to a Pipe

Tables

1-1 Linking Conflicts

1-2 UNIX and OpenVMS File Specification Delimiters

1-3 Valid and Invalid UNIX and OpenVMS File Specifications

1-4 Feature Test Macros - Standards

1-5 Functions with Dual Implementations

1-6 Functions restricted to 32-bit pointers

1-7 Callbacks that Pass Only 32-Bit Pointers

2-1 I/O Functions and Macros

2-2 Optional Characters Between % (or %n$) and the Input Conversion Specifier

2-3 Conversion Specifiers for Formatted Input

2-4 Optional Characters Between % (or %n$) and the Output Conversion Specifier

2-5 Conversion Specifiers for Formatted Output

3-1 Character, String, and Argument-List Functions

3-2 Character-Classification Functions

3-3 ASCII Characters and the Character-Classification Functions

4-1 Error- and Signal-Handling Functions

4-2 The Error Code Symbolic Values

4-3 DEC C RTL Signals

4-4 DEC C RTL Signals and Corresponding OpenVMS VAX Exceptions DEC C RTL Signals and Corresponding OpenVMS Alpha Exceptions Subprocess Functions

6-1 Curses Functions and Macros

6-2 Curses Predefined Variables and #define Constants

7-1 Math Functions

8-1 Memory Allocation Functions

9-1 System Functions

10-1 Locale Categories

11-1 Date/Time Functions

11-2 Time-zone Filename Acronyms

3 Interpretation of the mode Argument

4 File Protection Values and Their Meanings

5 RMS Valid Keywords and Values

6 Member Names

7 Optional Characters in strfmon Conversion Specifications

8 strfmon Conversion Specifiers

9 Optional Elements of strftime Conversion Specifications

10 strftime Conversion Specifiers

11 strptime Conversion Specifications

12 SYSCONF Argument and Return Values

13 Time-Zone Initialization Rules

14 The vfork and fork Functions

15 Optional Elements of wcsftime Conversion Specifications

16 wcsftime Conversion Specifiers

A-1 Structures Used by Socket Routines

A-2 errno Values

A-3 4.4BSD Entry Points

A-4 Basic Communication Routines

A-5 Auxiliary Communication Routines

A-6 Supported h_errno Routines

A-7 Supported Communication Routines

B-1 Functions Available on All OpenVMS Systems

B-2 Functions Added in OpenVMS Version 6.2

B-3 Functions Added in OpenVMS Version 7.0

B-4 Functions Added in OpenVMS Alpha Version 7.0

C-1 Duplicated Prototypes


Previous Page | Next Page | Table of Contents | Index