Library Functions and Macros

The functions and macros in the C Library are described in this chapter. They're arranged in alphabetical order.

Use the following links to find a function quickly:

A B C D E F G H I J K L
M N O P Q R S T U V W Y

What's in a function description?

Each description consists of a number of subsections:

Synopsis:

This subsection gives the header files that should be included within a source file that references the function or macro. It also shows an appropriate declaration for the function or for a function that could be substituted for a macro. This declaration isn't included in your program; only the header file(s) should be included.

When a pointer argument is passed to a function and that function does not modify the item indicated by that pointer, the argument is shown with const before the argument. For example, the following indicates that the array pointed at by string isn't changed:

    const char *string

Description:

This subsection is a description of the function or macro.

Returns:

This subsection describes the return value (if any) for the function or macro.

Errors:

This subsection describes the possible values that the function might assign to the global variable errno.

See Also:

This optional subsection provides a list of related functions or macros, or places to look for more information.

Example:

This optional subsection consists of one or more examples of the use of the function. The examples are often just fragments of code (not complete programs) for illustrative purposes.

Classification:

This subsection provides an indication of where the function or macro is commonly found. The following notation is used:

ANSI
These functions or macros are defined by the ANSI C standard.
Intel
These functions or macros are neither ANSI nor POSIX. They perform a function related to the Intel x86 architecture. They may be found in other implementations of C for personal computers using Intel chips. Use these functions with caution if portability is a consideration.
POSIX 1003.1
These functions or macros aren't defined by the ANSI C standard. They are specified in the document IEEE Standard Portable Operating System Interface for Computer Environments (IEEE Draft Standard 1003.1-1990).
POSIX 1003.2
These functions or macros aren't defined by the ANSI C standard. They are specified in the document Shell and Utility Application Interface for Computer Operating System Environments (IEEE Computer Society Working Group 1003.2).
POSIX 1003.4
These functions or macros aren't defined by the ANSI C standard. They are specified in the document Realtime Extensions for Computer Operating System Environments (IEEE Computer Society Working Group 1003.4).
QNX
These functions or macros are neither ANSI nor POSIX. They perform a function related to QNX. They may be found in other implementations of C for personal computers with QNX. Use these functions with caution, if portability is a consideration.
UNIX
These functions exist on some UNIX systems, but are outside of the POSIX or ANSI standards.
WATCOM
These functions or macros are neither ANSI nor POSIX. They may be found in other implementations of the C language, but caution should be used if portability is a consideration.

Systems:

This subsection provides an indication of where the function or macro is supported. The following notation is used:

All
This function is available on all systems.
DOS
This function is available on both 16-bit DOS and 32-bit extended DOS.
DOS/16
This function is available on 16-bit, real-mode DOS.
DOS/32
This function is available on 32-bit, protected-mode extended DOS.
DOS/PM
This 16-bit DOS protected-mode function is supported under Phar Lap's 286|DOS-Extender “RUN286”. The function is found in one of Watcom's 16-bit protected-mode DOS libraries (DOSPM*.LIB under the 16-bit OS2 subdirectory).
MACRO
This function is implemented as a macro (#define) on all systems.
Math
This function is a math function. Math functions are available on all systems.
Netware
This function is available on the 32-bit Novell Netware operating system.
OS/2.1x
This function is available on IBM OS/2 1.x, a 16-bit protected-mode system for Intel 80286 and upwards-compatible systems.

When “(MT)” appears after OS/2, it refers to the CLIBMTL library, which supports multi-threaded applications.

When “(DL)” appears after OS/2, it refers to the CLIBDLL library, which supports creation of Dynamic Link Libraries.

When “(all)” appears after “OS/2 1”, it means all versions of the OS/2 1.x libraries.

If a function is missing from the OS/2 library, it may be found in Watcom's 16-bit protected-mode DOS libraries (DOSPM*.LIB) for Phar Lap's 286|DOS-Extender (RUN286).

OS/2-32
This function is available on 32-bit IBM OS/2, a protected-mode system for Intel 80386 and upwards-compatible systems.
QNX
This function is available on QNX Software Systems Ltd's 16- or 32-bit operating systems.
QNX/16
This function is available on QNX Software Systems Ltd's 16-bit operating system.
QNX/32
This function is available on QNX Software Systems Ltd's 32-bit operating system.
Windows
This function is available on 16-bit, protected-mode Windows 3.x.
Win386
This function is available on Microsoft Windows 3.x, using Watcom's Windows Extender for 32-bit protected-mode applications running on Intel 386 or upwards-compatible systems.
Win32
This function is available on Microsoft Windows NT and Windows 95, 32-bit protected-mode systems for Intel 80386 and upwards-compatible systems. It may also be available for Windows 3.x using Win32s support.

Links to the Functions

A

abort() abs() access(), _access()
acos() acosh() alarm()
alloca() asctime(), _asctime() asin()
asinh() assert() atan()
atan2() atanh() atexit()
atof() atoh() atoi()
atol()

B

basename() _bcalloc() _beginthread()
Bessel functions _bexpand() _bfree()
_bfreeseg() _bgetcmd() _bheapchk()
_bheapmin() _bheapseg() _bheapset()
_bheapshrink() _bheapwalk() block_read()
block_write() _bmalloc() _bmsize()
_bprintf() _brealloc() bsearch()

C

cabs() calloc()
_CA_PCI_BIOS_Present() _CA_PCI_Find_Class()
_CA_PCI_Find_Device() _CA_PCI_GenerateSpecialCycle()
_CA_PCI_Read_Config_Byte() _CA_PCI_Read_Config_DWord()
_CA_PCI_Read_Config_Word() _CA_PCI_Write_Config_Byte()
_CA_PCI_Write_Config_DWord() _CA_PCI_Write_Config_Word()
ceil() cfgetispeed()
cfgetospeed() cfsetispeed()
cfsetospeed() cgets()
chdir() chmod()
chown() chsize()
_clear87() clearenv()
clearerr() clock()
clock_getres() clock_gettime()
clock_setres() clock_settime()
close() closedir()
closelog() _cmdname()
confstr() console_active()
console_arm() console_close()
console_ctrl() console_font()
console_info() console_open()
console_protocol() console_read()
console_size() console_state()
console_write() _control87()
cos() cosh()
cprintf() cputs()
creat() Creceive()
Creceivemx() cscanf()
ctermid() ctime(), _ctime()
cuserid()

D

delay() dev_arm() dev_fdinfo()
dev_info() dev_insert_chars() dev_ischars()
dev_mode() dev_osize() dev_read()
dev_readex() dev_size() dev_state()
difftime() _disable() disk_get_entry()
disk_space() div() dup()
dup2()

E

ecvt(), _ecvt() _enable() endgrent() endpwent()
_endthread() eof() errno exec... functions
_exit() exit() exp() _expand()

F

fabs() _fcalloc() fchmod()
fchown() fclose() fcloseall()
fcntl() fcvt(), _fcvt() fdatasync()
fdopen() feof() ferror()
_fexpand() fflush() _ffree()
fgetc() fgetchar() fgetpos()
fgets() _fheapchk() _fheapgrow()
_fheapmin() _fheapset() _fheapshrink()
_fheapwalk() filelength() fileno()
floor() flushall() _fmalloc()
fmod() _fmsize() fnmatch()
fopen() fork() FP_OFF()
FP_SEG() fpathconf() _fpreset()
fprintf() fputc() fputchar()
fputs() fread() _frealloc()
free() _freect() freopen()
frexp() fscanf() fseek()
fsetpos() _fsopen() fstat()
_fstrdup() fsync() fsys_fdinfo()
fsys_fstat() fsys_get_mount_dev() fsys_get_mount_pt()
fsys_stat() fsysinfo() ftell()
ftime() _fullpath() fwrite()

G

gcvt(), _gcvt() getc() getch()
getchar() getche() getcmd()
getcwd() getegid() getenv()
geteuid() getgid() getgrent()
getgrgid() getgrnam() getgroups()
getlogin() getnid() getopt()
getpgrp() getpid() getppid()
getprio() getpwent() getpwnam()
getpwuid() gets() getsid()
getuid() gmtime(), _gmtime()

H

halloc() _heapchk() _heapenable() _heapgrow()
_heapmin() _heapset() _heapshrink() _heapwalk()
hfree() hypot()

I

inp() inpd() input_line() inpw()
int386() int386x() int86() int86x()
intr() isalnum() isalpha() isascii(), __isascii()
isatty() iscntrl() __iscsym() __iscsymf()
isdigit() isgraph() islower() isprint()
ispunct() isspace() isupper() isxdigit()
itoa(), _itoa()

J

j0() j1() jn()

K

kbhit() kill()

L

labs() ldexp() ldiv()
lfind() link() localeconv()
localtime(), _localtime() lock() locking(), _locking()
log() log10() log2()
longjmp() _lrotl() _lrotr()
lsearch() lseek() lstat()
ltoa(), _ltoa() ltrunc()

M

main() _makepath() malloc() matherr()
max() mblen() mbstowcs() mbtowc()
_memavl() memccpy() memchr() memcmp()
memcpy() _memicmp() memicmp() _memmax()
memmove() memset() min() mkdir()
mkfifo() MK_FP() mknod() mktime()
mmap() modf() mount() mouse_close()
mouse_flush() mouse_open() mouse_param() mouse_read()
movedata() mprotect() mq_close() mq_getattr()
mq_notify() mq_open() mq_receive() mq_send()
mq_setattr() mq_unlink() _msize() munmap()

N

nanosleep() _ncalloc() _nexpand()
_nfree() _nheapchk() _nheapgrow()
_nheapmin() _nheapset() _nheapshrink()
_nheapwalk() _nmalloc() _nmsize()
nosound() _nrealloc()

O

offsetof() onexit() open() opendir()
openlog() outp() outpd() outpw()

P

pathconf() pause() pclose() perror()
pipe() popen() pow() printf()
print_usage() putc() putch() putchar()
putenv() puts()

Q

qnx_adj_time() qnx_device_attach()
qnx_device_detach() qnx_display_hex()
qnx_display_msg() qnx_fd_attach()
qnx_fd_detach() qnx_fd_query()
qnx_fullpath() qnx_getclock()
qnx_getids() qnx_hint_attach()
qnx_hint_detach() qnx_hint_mask()
qnx_hint_query() qnx_ioctl()
qnx_name_attach() qnx_name_detach()
qnx_name_locate() qnx_name_locators()
qnx_name_nodes() qnx_name_query()
qnx_net_alive() qnx_nidtostr()
qnx_osinfo() qnx_osstat()
qnx_pflags() qnx_prefix_attach()
qnx_prefix_detach() qnx_prefix_getroot()
qnx_prefix_query() qnx_prefix_setroot()
qnx_proxy_attach() qnx_proxy_detach()
qnx_proxy_rem_attach() qnx_proxy_rem_detach()
qnx_psinfo() qnx_scheduler()
qnx_segment_alloc() qnx_segment_alloc_flags()
qnx_segment_arm() qnx_segment_flags()
qnx_segment_free() qnx_segment_get()
qnx_segment_huge() qnx_segment_index()
qnx_segment_info() qnx_segment_overlay()
qnx_segment_overlay_flags() qnx_segment_put()
qnx_segment_raw_alloc() qnx_segment_raw_free()
qnx_segment_realloc() qnx_setclock()
qnx_setids() qnx_sflags()
qnx_sid_query() qnx_spawn()
qnx_spawn_options qnx_strtonid()
qnx_sync() qnx_ticksize()
qnx_trace_close() qnx_trace_info()
qnx_trace_open() qnx_trace_read()
qnx_trace_severity() qnx_trace_trigger()
qnx_umask() qnx_vc_attach()
qnx_vc_detach() qnx_vc_name_attach()
qnx_vc_poll_parm() qsort()

R

raise() rand() read(), readv() readdir()
readlink() Readmsg() Readmsgmx() realloc()
Receive() Receivemx() regcomp() regerror()
regexec() regfree() Relay() remove()
rename() Reply() Replymx() rewind()
rewinddir() rmdir() _rotl() _rotr()

S

sbrk() scanf() sched_getparam()
sched_getscheduler() sched_setparam() sched_setscheduler()
sched_yield() _searchenv() searchenv()
segread() select() sem_destroy()
sem_init() sem_post() sem_trywait()
sem_wait() Send() Sendfd()
Sendfdmx() Sendmx() setbuf()
setegid() setenv() seteuid()
setgid() setgrent() setjmp()
setlocale() setlogmask() setmode()
_setmx() set_new_handler(), _set_new_handler() setpgid()
setprio() setpwent() setsid()
setuid() setvbuf() shm_open()
shm_unlink() sigaction() sigaddset()
sigdelset() sigemptyset() sigfillset()
sigismember() siglongjmp() signal()
sigpending() sigprocmask() sigsetjmp()
sigsuspend() sin() sinh()
sleep() sopen() sound()
spawn... functions _splitpath2() sprintf()
sqrt() srand() sscanf()
stackavail() stat(), _stat() _status87()
strcat() strchr() strcmp()
strcmpi() strcoll() strcpy()
strcspn() _strdate() strdup(), _strdup()
strerror() strftime() stricmp(), _stricmp()
strlen() strlwr(), _strlwr() strncat()
strncmp() strncpy() strnicmp(), _strnicmp()
strnset() strpbrk() strrchr()
strrev(), _strrev() strset() strspn()
strstr() _strtime() strtod()
strtok() strtol() strtoul()
strupr(), _strupr() strxfrm() swab()
symlink() sync() sysconf()
syslog() system()

T

tan() tanh() tcdrain()
tcdropline() tcflow() tcflush()
tcgetattr() tcgetpgrp() tcsendbreak()
tcsetattr() tcsetct() tcsetpgrp()
tell() tfork() time()
timer_create() timer_delete() timer_gettime()
timer_settime() times() tmpfile()
tmpnam() tolower(), _tolower() toupper(), _toupper()
Trace... functions Trigger() ttyname()
tzset()

U

ultoa() umask() umount() uname()
ungetc() ungetch() unlink() unlock()
utime() utoa()

V

va_arg() va_end() va_start() _vbprintf() vcprintf()
vcscanf() vfprintf() vfscanf() vprintf() vscanf()
vsprintf() vsscanf() vsyslog()

W

wait() waitpid() wcstombs() wctomb()
write writev() Writemsg() Writemsgmx()

Y

y0() y1() Yield() yn()