[Previous]
[Contents]
[Next]

C Library Overview

This chapter lists the functions arranged by category and describes what's in a function description.

Functions arranged by categories

The functions in the Watcom C library can be organized into a number of categories:

The sections that follow describe these function categories in more detail. Each function in the category is noted with a brief description of its purpose.

Character manipulation

These functions operate upon single characters of type char. The functions test characters in various ways and convert them between upper and lowercase:

Function Summary
isalnum() test for a letter or digit
isalpha() test for a letter
isascii(), __isascii() test for an ASCII character
iscntrl() test for a control character
__iscsym() test for a letter, underscore or digit
__iscsymf() test for a letter or underscore
isdigit() test for a digit
isgraph() test for a printable character, except a space
islower() test for a letter in lowercase
isprint() test for a printable character, including a space
ispunct() test for punctuation characters
isspace() test for "white space" characters
isupper() test for a letter in uppercase
isxdigit() test for a hexadecimal digit
tolower() convert a character to lowercase
toupper() convert a character to uppercase

Console I/O

These functions provide the capability to read and write data from the console. Data is read or written without any special initialization (devices are not opened or closed), since the functions operate at the hardware level.

The following functions are defined:

Function Summary
cgets() get a string from the console
cprintf() print a formatted string to the console
cputs() write a string to the console
cscanf() scan formatted data from the console
getch() get a character from console, without echoing it
getche() get a character from console, echoing it
kbhit() test if a keystroke is available
putch() write a character to the console
ungetch() push back the next character from the console
vcprintf() write formatted output directly to the console
vcscanf() scan input from the console

QNX also provides the following functions that deal with consoles:

Function Summary
console_active() make the indicated console the "active" console
console_arm() trigger the specified proxy whenever one of the indicated console events occurs on the console
console_close() close a previously opened control channel to the device driver of a console device
console_ctrl() set bits in the console control word
console_font() change a console font
console_info() get console information
console_open() open up a control channel to the device driver of a console device
console_protocol() change a console's protocol emulation
console_read() read data directly from the video buffer of the indicated console
console_size() change and or report the size of the indicated console
console_state() test and set (or clear) the state of the current events that are pending on the indicated console device
console_write() write data directly to the video buffer of the indicated console

Conversion

To and from strings

These functions perform conversions between objects of various types and strings:

Function Summary
atof() string to double
atoh() hexadecimal string to unsigned int
atoi() string to int
atol() string to long int
ecvt(), _ecvt() double to E-format string
fcvt(), _fcvt() double to F-format string
gcvt(), _gcvt() double to string
itoa(), _itoa() int to string
ltoa(), _ltoa() long int to string
_strdate() copy the current date into a buffer
_strtime() copy the current time into a buffer
strtod() string to double
strtol() string to long int
strtoul() string to unsigned long int
ultoa(), _ultoa() unsigned long int to string
utoa() unsigned int to string

See also:

Devices

These QNX functions pertain to devices:

Function Summary
dev_arm() trigger the specified proxy whenever one of the indicated terminal device events occurs on the terminal device associated with the specified file descriptor
dev_fdinfo() return information about the terminal device that is controlled by the specified server process, and that is associated with the specified file descriptor belonging to the specified process
dev_info() return information about the terminal device associated with the specified file descriptor
dev_insert_chars() insert characters into the canonical input buffer of the opened device
dev_ischars() return the number of bytes available to be read from the terminal device associated with the specified file descriptor
dev_mode() test and optionally set (or clear) one of the input/output modes pertaining to the terminal device associated with specified file descriptor
dev_osize() set the output trigger threshold
dev_read() read up to n bytes of data from the specified terminal device into a buffer
dev_readex() read any exception (or out-of-bound) data associated with the device
dev_size() set or query the rows and columns of a device
dev_state() test and set (or clear) the state of the current events that are pending on the terminal device associated with the specified file descriptor

Directories

These functions manipulate directories:

Function Summary
chdir() change the current working directory
closedir() close an opened directory file
getcwd() get the current working directory
mkdir() make a new directory
opendir() open a directory file
readdir() read a file name from a directory
rewinddir() reset the position of a directory stream
rmdir() remove a directory

File manipulation

These functions operate directly with files:

Function Summary
access() test a file or directory for mode of access
chmod() change the permissions for a file
chown() change the owner user ID and group ID of the specified file
fchmod() change the permissions for the file associated with the specified file descriptor to the specified mode
fchown() change the user ID and group ID of the file associated with the specified file descriptor to the specified numeric values
fpathconf() determine the value of a configurable limit associated with a file or directory
lstat() get information about a file, directory, or symbolic link
pathconf() determine the value of a configurable limit associated with a file or directory
remove() delete a file
rename() rename a file
stat() get information about a file or directory
tmpnam() create a name for a temporary file
unlink() delete a file
utime() set the modification time for a file

Heaps

These functions provide the ability to shrink and grow the heap, as well as find heap-related problems.

Function Summary
_heapchk() perform a consistency check on the heap
_bheapchk() perform a consistency check on a based heap
_fheapchk() perform a consistency check on the far heap
_nheapchk() perform a consistency check on the near heap
_heapenable() control attempts to grow the heap
_heapgrow() grow the heap
_fheapgrow() grow the far heap
_nheapgrow() grow the near heap up to its limit of 64K
_heapmin() shrink the heap as much as possible
_bheapmin() shrink a based heap as much as possible
_fheapmin() shrink the far heap as much as possible
_nheapmin() shrink the near heap as much as possible
_heapset() fill the unallocated sections of heap with a pattern
_bheapset() fill the unallocated sections of based heap with a pattern
_fheapset() fill the unallocated sections of far heap with a pattern
_nheapset() fill the unallocated sections of near heap with a pattern
_heapshrink() shrink the heap as much as possible
_bheapshrink() shrink a based heap as much as possible
_fheapshrink() shrink the far heap as much as possible
_nheapshrink() shrink the near heap as much as possible
_heapwalk() walk through each entry in the heap
_bheapwalk() walk through each entry in a based heap
_fheapwalk() walk through each entry in the far heap
_nheapwalk() walk through each entry in the near heap

Intel 80x86 architecture-specific functions

These functions provide the capability to invoke Intel 80x86 processor-related functions directly from a program. Functions that apply to the Intel 8086 CPU apply to that family including the 80286, 80386, 80486 and Pentium processors. The following functions are defined:

Function Summary
_CA_PCI_BIOS_Present() determine whether or not PCI BIOS is present
_CA_PCI_Find_Class() find devices that have a specific class code
_CA_PCI_Find_Device() find the PCI device with a given device ID and vendor ID
_CA_PCI_Read_Config_Byte() read a byte from the configuration space of a device
_CA_PCI_Read_Config_DWord() read a double word from the configuration space of a device
_CA_PCI_Read_Config_Word() read a word from the configuration space of a device
_CA_PCI_Generate_Special_Cycle() generate a special cycle on a PCI bus
_CA_PCI_Write_Config_Byte() write individual bytes to the configuration space of a device
_CA_PCI_Write_Config_DWord() write individual double words to the configuration space of a device
_CA_PCI_Write_Config_Word() write individual words to the configuration space of a device
_disable() disable interrupts
_enable() enable interrupts
FP_OFF() get the offset part of a far pointer
FP_SEG() get the segment part of a far pointer
inp() get one byte from a hardware port
inpd() read a double-word from an 80x86 hardware port
inpw() get two bytes (one word) from a hardware port
MK_FP() make a far pointer from the segment and offset values
nosound() turn off the speaker
outp() write one byte to a hardware port
outpd() write a double-word to an 80x86 hardware port
outpw() write two bytes (one word) to a hardware port
segread() read segment registers
sound() turn on the speaker at the specified frequency

Math

The mathematical functions perform mathematical computations such as the common trigonometric calculations. These functions operate with objects of type double, also known as floating-point numbers. The Intel 8087 processor (and its successor chips) is commonly used to implement floating-point operations on personal computers. Functions ending in "87" pertain to this specific hardware, and should be isolated in programs when portability is a consideration.

Function Summary
abs() absolute value of an object of type int
acos() arccosine
acosh() inverse hyperbolic cosine
asin() arcsine
asinh() inverse hyperbolic sine
atan() arctangent of one argument
atan2() arctangent of two arguments
atanh() inverse hyperbolic tangent
cabs() absolute value of a complex number
ceil() ceiling function
_clear87() clears floating-point status
_control87() sets new floating-point control word
cos() cosine
cosh() hyperbolic cosine
div() compute quotient and remainder from division of an int object
exp() exponential function
fabs() absolute value of double
floor() floor function
fmod() modulus function
_fpreset() initialize for floating-point operations
frexp() fractional exponent
hypot() compute hypotenuse
j0(), j1(), jn() return Bessel functions of the first kind
labs() absolute value of an object of type long int
ldexp() multiply by a power of two
ldiv() get quotient and remainder from division of object of type long int
log() natural logarithm
log10() logarithm, base 10
log2() logarithm, base 2
matherr() handle errors from math functions
max(), __max() return the maximum of two arguments
min(), __min() return the minimum of two arguments
modf() get the integral and fractional parts of a double
pow() raise to power
rand() random integer
sin() sine
sinh() hyperbolic sine
sqrt() square root
srand() set starting point for generation of random numbers using rand() function
_status87() get the floating-point status
tan() tangent
tanh() hyperbolic tangent
y0(), y1(), yn() return Bessel functions of the second kind

Memory allocation

These functions allocate and de-allocate blocks of memory.

The default data segment has a maximum size of 64K bytes. It may be less in a machine with insufficient memory, or when other programs in the computer already occupy some of the memory. The _nmalloc() function allocates space within this area.

In a small data model, the malloc(), calloc() and realloc() functions use the _nmalloc() function to acquire memory.

It is important to use the appropriate memory-deallocation function to free memory blocks:

The free() function uses the _nfree() function when the small data memory model is used.


Note: The _nmalloc() function can be used in either data memory model.

The following functions are defined:

Function Summary
alloca() allocate automatic storage from stack
_bcalloc() allocate and zero memory from a based heap
_bexpand() expand a block of memory in a based heap
_bfree() free a block of memory in a based heap
_bfreeseg() free a based heap
_bheapseg() allocate a based heap
_bmalloc() allocate a memory block from a based heap
_bmsize() return the size of a memory block
_brealloc() reallocate a memory block in a based heap
calloc() allocate and zero memory
_expand() expand a block of memory
_fcalloc() allocate and zero a memory block (outside the default data segment)
_fexpand() expand a block of memory (outside the default data segment)
_ffree() free a block allocated using _fmalloc()
_fmalloc() allocate a memory block (outside the default data segment)
_fmsize() return the size of a memory block
_frealloc() reallocate a memory block (outside default data segment)
free() free a block allocated using malloc(), calloc() or realloc()
_freect() return the number of objects that can be allocated
halloc() allocate a huge array
hfree() free a huge array
malloc() allocate a memory block (using the current memory model)
_memavl() return the amount of available memory
_memmax() return the size of the largest block of memory available
_msize() return the size of a memory block
_ncalloc() allocate and zero a memory block (inside the default data segment)
_nexpand() expand a block of memory (inside the default data segment)
_nfree() free a block allocated using _nmalloc()
_nmalloc() allocate a memory block (inside the default data segment)
_nmsize() return the size of a memory block
_nrealloc() reallocate a memory block (inside the default data segment)
realloc() reallocate a block of memory
sbrk() set the allocation "break" position
stackavail() determine the available amount of stack space

Memory manipulation

These functions manipulate blocks of memory. In each case, the address of the memory block and its size are passed to the function. Functions whose names begin with _f accept far pointers as their arguments, allowing manipulation of any memory location, regardless of which memory model your program has been compiled for.

Function Summary
_fmemccpy() copy a far memory block up to a certain character
_fmemchr() search a far memory block for a character value
_fmemcmp() compare any two memory blocks (near or far)
_fmemcpy() copy a far memory block, overlap not allowed
_fmemicmp() compare far memory, case insensitive
_fmemmove() copy a far memory block, overlap allowed
_fmemset() set any memory block (near or far) to a character
memccpy() copy a memory block up to a certain character
memchr() search a memory block for a character value
memcmp() compare memory blocks
memcpy() copy a memory block, overlap not allowed
memicmp() compare memory, case insensitive
memmove() copy a memory block, overlap allowed
memset() set a memory block to a character
movedata() copy a memory block, with segment information
swab() swap bytes of a memory block

See also:

Miscellaneous

The following functions are defined:

Function Summary
assert() test an assertion and output a string on failure
_fullpath() return the full path specification for a file
localeconv() obtain locale-specific conversion information
longjmp() return and restore the environment saved by setjmp()
_lrotl() rotate an unsigned long to the left
_lrotr() rotate an unsigned long to the right
_makepath() make a full filename from specified components
offsetof() get the offset of a field in a structure
_rotl() rotate an unsigned int to the left
_rotr() rotate an unsigned int to the right
setjmp() save the environment for use with longjmp()
setlocale() set a locale
set_new_handler(), _set_new_handler() set the error handler for the C++ new() operator
sigsetjmp() save the environment and the signal mask for a process, for use with the siglongjmp() function
_setmx() stuff the fields of a _mxfer_entry
siglongjmp() return and restore the environment and signal mask saved by sigsetjmp()
_splitpath() split a filename into its components
_splitpath2() split a filename into its components
Trace functions log timestamped events into a system trace buffer

Mouse

These functions provide access to the mouse and its driver:

Function Summary
mouse_close() close a previously opened control channel to a mouse driver
mouse_flush() discard any pending mouse events in the mouse queue associated with the specified mouse control channel
mouse_open() open up a control channel to the mouse driver
mouse_param() set or query the current control parameters for the specified mouse
mouse_read() read up to n mouse events from the mouse server associated with the specified mouse control channel into the specified buffer

Multibyte characters

These ANSI C functions provide capabilities for processing multibyte characters:

Function Summary
mblen() determine the length of the next multibyte character
mbstowcs() convert a multibyte character string to a wide character string
mbtowc() convert a multibyte character to a wide character
wcstombs() convert a wide character string to a multibyte character string
wctomb() convert a wide character to a multibyte character

Multibyte-character-string manipulation

These functions manipulate strings of multibyte characters. A multibyte character is either a single-byte or double-byte character. The Chinese, Japanese and Korean character sets are examples of character sets containing both single-byte and double-byte characters.

What determines whether a character is a single-byte or double-byte character is the value of the lead byte in the sequence. For example, in the Japanese DBCS (double-byte character set), double-byte characters are those in which the first byte falls in the range 0x81 - 0x9F or 0xE0 - 0xFC and the second byte falls in the range 0x40 - 0x7E or 0x80 - 0xFC.

A string of multibyte characters must be scanned from the first byte (index 0) to the last byte (index n) in sequence in order to determine if a particular byte is part of a double-byte character. For example, suppose that a multibyte character string contains the following byte values:

0x31 0x40 0x41 0x81 0x41 // "1@A.." where .. is a DB char

Among other characters, it contains the letter A (the first 0x41) and a double-byte character (0x81 0x41). The second 0x41 isn't the letter A and that could only be determined by scanning from left to right starting with the first byte (0x31).

The following functions are defined:

Function Summary
mbstowcs() convert a multibyte-character string into a wide-character string
wcstombs() convert a wide-character string into a multibyte-character string
wctomb() convert a wide character into a multibyte character

See also:

O/S-level I/O

These functions operate at the operating-system level, and are included for compatibility with other C implementations. It is recommended that the File Manipulation functions be used for new programs, as these functions are defined portably, and are part of the ANSI standard for the C language.

The functions in this section reference opened files and devices using a file descriptor that's returned when the file is opened. The file descriptor is passed to the other functions. The following functions are defined:

Function Summary
chsize() change the size of a file
close() close a file
creat() create a file
dup() duplicate a file descriptor, getting an unused descriptor number
dup2() duplicate a file descriptor, supplying a new descriptor number
eof() test for the end of a file
fcntl() control over an open file
fdatasync() write queued file data to disk
filelength() get file size
fileno() get a file descriptor for a stream file
fstat() get file status
fsync() write queued file and filesystem data to disk
link() create a new directory entry
lock() lock a section of a file
locking(), _locking() lock/unlock a section of a file
lseek() set the current file position
ltrunc() truncate a file
mkfifo() make a FIFO special file
mknod() make a filesystem entry point
mount() mount a filesystem
open() open a file
pclose() close a pipe
pipe() create an inter-process channel
popen() open a pipe
read() read a record
readlink() read a symbolic link
readv() read several records, placing them into a specified number of buffers
select() synchronous I/O multiplexing
setmode() set file mode
sopen() open a file for shared access
symlink() create a symbolic link
sync() synchronize the filesystem
tell() get the current file position
umask() set the file permission mask
umount() unmount a filesystem
unlink() delete a file
unlock() unlock a section of a file
write() write a record
writev() write several records from a specified number of buffers

These functions also operate at the operating-system level, but are specific to QNX:

Function Summary
block_read() read a specified number of blocks of data from a file
block_write() write a specified number of blocks of data to a file
disk_get_entry() obtain information about the disk (both logical partition and physical disk) associated with the specified file descriptor
disk_space() obtain information about the size of the disk associated with the specified file descriptor
fsys_fdinfo() queries the server for information about the file associated with the file descriptor that belongs to process pid
fsys_get_mount_dev() find and return the device that a file is on
fsys_get_mount_pt() find and return the file system mount point ("directory") associated with the named device
fsys_fstat() obtain detailed information about an open file
fsys_stat() obtain detailed information about a file
fsysinfo() return information from the file system manager for a file
input_line() get a string of characters from the specified file, and store it in the specified array

POSIX message queues

These functions deal with message queues:

Function Summary
mq_close() close a message queue
mq_getattr() get the current attributes of a message queue
mq_notify() notify the calling process when the queue becomes nonempty
mq_open() open a message queue
mq_receive() receive a message from a queue
mq_send() put a message into a message queue
mq_setattr() set the flags for a message queue
mq_unlink() delete a message queue

POSIX realtime timers

These functions provide realtime timer capabilities:

Function Summary
clock_getres() get the resolution of a clock
clock_gettime() get the current time of a clock
clock_setres() set the resolution of a clock
clock_settime() set the current time of a clock
nanosleep() suspend a process until a timeout or signal
timer_create() create a timer for current process
timer_delete() return a timer to the free list
timer_gettime() get the pending expiration time of a timer
timer_settime() set the expiration time of a timer

POSIX semaphores

These functions deal with semaphores:

Function Summary
sem_destroy() destroy a semaphore
sem_init() initialize a semaphore
sem_post() increment a semaphore
sem_trywait() wait on a semaphore, but don't block
sem_wait() wait on a semaphore

POSIX shared memory

These functions provide memory mapping capabilities:

Function Summary
mmap() map process addresses to a memory object
mprotect() change memory protection
munmap() unmap previously mapped addresses
shm_open() open a shared memory object
shm_unlink() remove a shared memory object

POSIX terminal control

These functions deal with terminal attributes, such as baud rate and terminal interface control functions. The following functions are defined:

Function Summary
cfgetispeed() get the terminal input baud rate
cfgetospeed() get the terminal output baud rate
cfsetispeed() set the terminal input baud rate
cfsetospeed() set the terminal output baud rate
tcdrain() wait until all output is written
tcdropline() initiate a disconnect condition on the communication line associated with the specified opened file descriptor
tcflow() suspend the transmission or reception of data
tcflush() discard untransmitted data
tcgetattr() get terminal attributes
tcgetpgrp() return the value of process group ID of the foreground process group associated with the terminal
tcsetattr() set terminal attributes
tcsetct() make the terminal device, associated with the specified file descriptor, a controlling terminal that's associated with the specified process id
tcsetpgrp() set the foreground process group ID associated with the terminal
tcsendbreak() transmit a terminal "break" for a specified time

Process environment

These functions deal with process identification, user identification, process groups, system identification, system time and process time, environment variables, terminal identification, and configurable system variables:

Function Summary
_bgetcmd() get the command line
clearenv() delete environment variables
_cmdname() get the executing program's pathname
confstr() get configuration-defined string values
ctermid() return the name of the controlling terminal
cuserid() generate the login name of the owner of the process
getcmd() get the command line
getegid() return the effective group ID
getenv() get an environment variable value
geteuid() return the effective user ID
getgid() return the real group ID
getgroups() get supplementary group IDs
getlogin() return the user's login name
getnid() return a node ID
getopt() a command-line parser that can be used by applications that follow guidelines 3,4,5,6,7,9 and 10 in POSIX Utility Syntax Guidelines 1003.2 2.11.2
getpgrp() return the process group ID
getpid() return the process ID of the calling process
getppid() return the parent process ID of the calling process
getprio() return the current priority of the specified process ID
getsid() return the session ID of a process
getuid() return the real user ID
isatty() determine if the file descriptor is associated with a terminal
main() the function where program execution begins
print_usage() print a program's usage message
putenv() add, change or delete environment variables
_searchenv() search for a file in a list of directories
searchenv() search for a file in a list of directories
setegid() set the effective group ID
setenv() add, change or delete environment variables
seteuid() set the effective user ID
setgid() set the real group ID, effective group ID
setpgid() set the process group ID for job control
setprio() change the priority of the process identified by the specified process ID to the specified priority
setsid() create a new session and set the process group ID
setuid() set the real user ID, the effective user ID
sysconf() determine the value of configurable system limit or option
times() return time-accounting information
ttyname() return a pointer to string containing the pathname of terminal associated with a file descriptor
uname() return operating system identification
Yield() check to see if other processes at the same priority as that of the calling process are READY to run

Process primitives

These functions deal with process creation, execution and termination, signal handling, and timer operations.


Note: The QNX libraries aren't completely thread-safe. Before calling a function in a thread, check its Classification section to make sure it's safe to do so.

When a new process is started, it replaces the existing process in the following cases:

The existing process may be suspended while the new process executes (control continues at the point following the place where the new process was started) in the following situations:

The following functions are defined:

Function Summary
abort() terminate a process immediately, return code 3
alarm() send the calling process a SIGALRM signal after a specified time
atexit() register an exit routine
_beginthread() start a new thread of execution
delay() delay for a number of milliseconds
_endthread() end the current thread
execl() chain to a program
execle() chain to a program, pass the environment
execlp() chain to a program
execlpe() chain to a program, pass the environment
execv() chain to a program
execve() chain to a program, pass the environment
execvp() chain to a program
execvpe() chain to a program, pass the environment
exit() exit the process, set return code
_exit() exit the process, set return code
fork() create a new process
kill() send a signal to a specified process
onexit() register an exit routine
pause() suspend the calling process until signal
raise() signal an exceptional condition
sched_getparam() get current scheduling parameters of a process
sched_getscheduler() get the current scheduling policy of a process
sched_setparam() set the scheduling parameters of a process
sched_setscheduler() set the priority and scheduling policy of a process
sched_yield() give up the processor to another process
sigaction() examine or specify action for a specific signal
sigaddset() add a specified signal to a set
sigdelset() delete a specified signal from a set
sigemptyset() initialize a signal set to exclude certain signals
sigfillset() initialize a signal set to include certain signals
sigismember() test whether or not a signal is a member of a set
signal() set the handling for an exceptional condition
sigpending() store a set of pending signals
sigprocmask() examine or change a process's signal mask
sigsuspend() replace a process's signal mask, and then suspend the process
sleep() delay for a number of seconds
spawnl() create a process
spawnle() create a process, set the environment
spawnlp() create a process
spawnlpe() create a process, set the environment
spawnv() create a process
spawnve() create a process, set the environment
spawnvp() create a process
spawnvpe() create a process, set the environment
system() execute a system command
tfork() create a new thread of execution
wait() wait for any child process to terminate
waitpid() wait for a child process to terminate

There are eight spawn...() and exec...() functions each. The "..." is one to three letters:

QNX low-level functions

These functions provide the capability to invoke QNX functions directly from a program:

Function Summary
qnx_adj_time() gradually adjust the system clock
qnx_device_attach() attach a major device number to a resource manager
qnx_device_detach() detach a major device number from an I/O manager
qnx_display_hex() print a hexadecimal number on the screen of the physical console
qnx_display_msg() display a message on the screen of the physical console
qnx_fd_attach() get a new file descriptor
qnx_fd_detach() detach a file descriptor
qnx_fd_query() get information about a file descriptor
qnx_fullpath() expand a path into a full path
qnx_getclock() get the current time from a clock
qnx_getids() get IDs associated with a process
qnx_hint_attach() attach a handler function to a hardware interrupt
qnx_hint_detach() detach a handler from a hardware interrupt
qnx_hint_mask() query, enable or disable a hardware interrupt
qnx_hint_query() get information on the handler for a hardware interrupt
qnx_ioctl(), qnx_ioctlmx() issue special control requests to the driver for a file descriptor
qnx_name_attach() register a process under a given name
qnx_name_detach() remove the name associated with a process
qnx_name_locate() get the ID of the process registered under a given name
qnx_name_locators() get a list of nodes running global name locators
qnx_name_nodes() find a given name on all nodes
qnx_net_alive() determine the status of all nodes on the network
qnx_name_query() get information on a given name
qnx_nidtostr() convert a numeric node ID to a string
qnx_osinfo() get information on a given node ID
qnx_osstat() get the status of a node
qnx_pflags() examine and modify the systems flags word of a process
qnx_prefix_attach() attach a pathname prefix
qnx_prefix_detach() detach a pathname prefix
qnx_prefix_getroot() get the current network prefix root for the process
qnx_prefix_query() get a prefix tree below a given path on a given node
qnx_prefix_setroot() change the default network prefix for the process
qnx_proxy_attach() create a proxy to be attached to a process
qnx_proxy_detach() detach a proxy from a process
qnx_proxy_rem_attach() create a virtual proxy on a remote node
qnx_proxy_rem_detach() detach a virtual proxy on a remote node
qnx_psinfo() get information on a given process ID
qnx_scheduler() change the priority of a process
qnx_segment_alloc() allocate a segment of memory
qnx_segment_alloc_flags() allocate a segment of memory, specifying some option flags
qnx_segment_arm() arm a segment, so other processes can share it
qnx_segment_flags() change the access flags for a segment
qnx_segment_free() free a segment of memory
qnx_segment_get() get shared access to a segment
qnx_segment_huge() allocate a huge segment of memory
qnx_segment_index() get the segment associated with a given index into a segment table
qnx_segment_info() get information on a segment
qnx_segment_overlay() create a segment that overlays memory
qnx_segment_overlay_flags() create a segment that overlays memory, specifying some option flags
qnx_segment_put() give shared access to a segment
qnx_segment_raw_alloc() allocate a contiguous segment of memory, removing it from the system memory map
qnx_segment_raw_free() add a contiguous segment of memory to the system memory map
qnx_segment_realloc() change the size of a segment
qnx_setclock() set the current time of a clock
qnx_setids() change the real and effective user and group IDs of a process
qnx_sflags() examine and modify the system flags word on a node
qnx_sid_query() get information on a given session ID
qnx_spawn() create a new process
qnx_spawn_options a structure of global options for qnx_spawn()
qnx_strtonid() convert a string into a node ID
qnx_sync() request the file manager to flush all buffers
qnx_ticksize() set the system tick size
qnx_trace_close() close a channel to a trace buffer
qnx_trace_info() get information from a trace buffer
qnx_trace_open() open a channel to a trace buffer
qnx_trace_read() read events from a trace buffer
qnx_trace_severity() select the minimum severity of events to be traced
qnx_trace_trigger() cause a proxy to be triggered when the data in a trace buffer reaches a given level
qnx_umask() set the file mode creation mask for a process
qnx_vc_attach() establish a virtual circuit between two processes
qnx_vc_detach() free a virtual circuit between two processes
qnx_vc_name_attach() establish a virtual circuit to the process with a given name
qnx_vc_poll_parm() change the polling parameters for a virtual circuit

QNX messaging

These functions provide access to message passing:

Function Summary
Creceive() check to see if a message is waiting from the process identified by the specified process ID
Creceivemx() check to see if a message is waiting from the process identified by the specified process ID
Readmsg() read n bytes of data into a specified buffer from the process identified by the specified process ID
Readmsgmx() read data into a specified array of buffers from the process identified by the specified process ID
Receive() wait for a message from the process identified by the specified process ID
Receivemx() check to see if a message from the process identified by the specified process ID is waiting
Relay() take the message received from the specified source process, and relay it to the specified target process
Reply() reply with a number of bytes of the specified data to the process identified by the specified process ID
Replymx() reply with a message taken from the specified array of message buffers to the process identified by the specified process ID
Send() send the specified message to the process identified by the specified process ID
Sendfd() send the specified message to the process associated with the specified file descriptor
Sendfdmx() send a message taken from the specified array of buffers to the process associated with the specified file descriptor
Sendmx() send a message taken from the specified array of buffers to the process identified by the specified process ID
Trigger() trigger the specified proxy to send a message to the process that owns it
Writemsg() write n bytes of data from the specified buffer to the reply message buffer identified by the specified process ID
Writemsgmx() write a message taken from the specified array of message buffers to the reply message buffer identified by the specified process ID

Searching

These functions provide searching and sorting capabilities:

Function Summary
bsearch() find a data item in an array using a binary search
_fstrcspn() get the number of string characters not from a given set of characters
_fstrstr() find one far string inside another
lfind() find a data item in an array using a linear search
lsearch() find a data item in an array using a linear search, adding the item if it isn't found
qsort() sort an array

Stream I/O

These functions provide the "standard" functions to read and write files. Data can be transmitted as characters, strings, blocks of memory or under format control.

A stream is the name given to a file or device that has been opened for data transmission. When a stream is opened, a pointer to a FILE structure is returned. This pointer is used to reference the stream when other functions are subsequently invoked.

When a program begins execution, there are a number of streams already open for use:

stdin
Standard Input: input from the console
stdout
Standard Output: output to the console
stderr
Standard Error: output to the console (used for error messages)

These standard streams may be re-directed by use of the freopen() function.

The Operating System I/O functions may also be invoked (use the fileno() function to obtain the file descriptor). Since the stream functions may buffer input and output, these functions should be used with caution to avoid unexpected results.

Function Summary
clearerr() clear the end-of-file and error indicators for stream
fclose() close a stream
fcloseall() close all open streams
fdopen() open a stream, given a descriptor
feof() test for the end of a file
ferror() test for a file error
fflush() flush an output buffer
fgetc() get the next character from file
fgetchar() equivalent to fgetc() with the argument stdin
fgetpos() get the current file position
fgets() get a string
flushall() flush the output buffers for all streams
fopen() open a stream
fprintf() format output
fputc() write a character
fputchar() write a character to the stdout stream
fputs() write a string
fread() read a number of objects
freopen() re-open a stream
fscanf() scan input according to a format
fseek() set the current file position, relative
fsetpos() set the current file position, absolute
_fsopen() open a shared stream
ftell() get the current file position
fwrite() write a number of objects
getc() read a character
getchar() get the next character from stdin
gets() get a string from stdin
perror() write an error message to stderr stream
printf() format output to stdout
putc() write a character to a file
putchar() write a character to stdout
puts() write a string to stdout
rewind() position to the start of a file
scanf() scan input from stdin, under format control
setbuf() set a buffer
setvbuf() set buffering
tmpfile() create a temporary file
ungetc() push a character back on the input stream
vfprintf() same as fprintf(), but with variable arguments
vfscanf() same as fscanf(), but with variable arguments
vprintf() same as printf(), but with variable arguments
vscanf() same as scanf(), but with variable arguments

See also:

String manipulation

A string is an array of characters (with type char) that is terminated with an extra null character ('\0'). Functions are passed only the address of the string, since the size can be determined by searching for the terminating character. The functions that begin with _f accept far pointers as their arguments, allowing manipulation of any memory location, regardless of which memory model your program has been compiled for.

Function Summary
basename() return a pointer to the first character following the last "/" in a string
_bprintf() formatted transmission to a fixed-length string
_cmdname() get the executing program's pathname
fnmatch() check the specified string to see if it matches the specified pattern
_fstrcat() concatenate two far strings
_fstrchr() locate a character in a far string
_fstrcmp() compare two far strings
_fstrcpy() copy a far string
_fstrcspn() get the number of string characters not from a set of characters
_fstrdup() allocate and duplicate a string
_fstricmp() compare two far strings with case insensitivity
_fstrlen() compute the length of a far string
_fstrlwr() convert a far string to lowercase
_fstrncat() concatenate two far strings, up to a maximum length
_fstrncmp() compare two far strings up to maximum length
_fstrncpy() copy a far string, up to a maximum length
_fstrnicmp() compare two far strings with case insensitivity, up to a maximum length
_fstrnset() fill a far string with a character, to a maximum length
_fstrpbrk() locate an occurrence of a string within a second string
_fstrrchr() locate the last occurrence of a character from a character set
_fstrrev() reverse a far string in place
_fstrset() fill a far string with a character
_fstrspn() find the number of characters at the start of a string that are also in a second string
_fstrstr() find the first occurrence of a string in a second string
_fstrtok() get the next token from a far string
_fstrupr() convert a far string to uppercase
regcomp() regular expression compiler
regerror() print an error string resulting from a regcomp() or regexec() call
regexec() compare the specified string against the compiled regular expression
regfree() release all memory allocated by the regular expression compiler
sprintf() formatted transmission to a string
sscanf() scan from a string, under format control
strcat() concatenate two strings
strchr() locate a character in a string
strcmp() compare two strings
strcmpi() compare two strings, with case insensitivity
strcoll() compare two strings using the locale's collating sequence
strcpy() copy a string
strcspn() get the number of string characters not from a set of characters
strdup() allocate and duplicate a string
strerror() get an error message as a string
stricmp() compare two strings, with case insensitivity
strlen() compute the length of a string
strlwr() convert a string to lowercase
strncat() concatenate two strings, up to a maximum length
strncmp() compare two strings, up to maximum length
strncpy() copy a string, up to a maximum length
strnicmp() compare two strings, with case insensitivity, up to a maximum length
strnset() fill a string with a character, to a maximum length
strpbrk() locate an occurrence of a string within a second string
strrchr() locate the last occurrence of a character from a character set
strrev() reverse a string in place
strset() fill a string with a character
strspn() find the number of characters at the start of a string that are also in a second string
strstr() find the first occurrence of a string in a second string
strtok() get the next token from a string
strupr() convert a string to uppercase
strxfrm() transform a string to the locale's collating sequence
_vbprintf() same as _bprintf(), but with variable arguments
vsprintf() same as sprintf(), but with variable arguments
vsscanf() same as sscanf(), but with variable arguments

See also:

System databases

These functions allow an application to access group and user database information. The following functions are defined:

Function Summary
endgrent() close a group database
endpwent() close the list of system users
getgrent() get the next group entry
getgrgid() get the group information, based on a group ID
getgrnam() get the group information, based on a name
getpwent() peruse the list of system users
getpwnam() get password information, based on a name
getpwuid() get password information, based on a user ID
setgrent() rewind to the start of a group database
setpwent() rewind to the start of the list of system users

System message log

This set of functions controls the system log:

Function Summary
closelog() close the log file
openlog() set up the processing of messages for the log
setlogmask() set the log priority mask
syslog() write a message to the log
vsyslog() write a message to the log (varargs)

Time

These functions are concerned with dates and times.

Function Summary
_asctime() make a time string from a time structure
asctime() make a time string from a time structure
clock() get the time since the program started
_ctime() get the calendar time string
ctime() get the calendar time string
difftime() calculate the difference between two times
ftime() return the current time in a timeb structure
_gmtime() convert calendar time to Coordinated Universal Time (UTC)
gmtime() convert calendar time to Coordinated Universal Time (UTC)
_localtime() convert calendar time to local time
localtime() convert calendar time to local time
mktime() make calendar time from local time
_strdate() format the date as MM/DD/YY
strftime() format the date and time
_strtime() format the time as HH:MM:SS
time() get the current calendar time
tzset() set global variables to reflect the local time zone

Variable-length argument lists

Variable-length argument lists are used when a function doesn't have a fixed number of arguments. These macros provide the capability to access these arguments:

Function Summary
va_arg() get the next variable argument
va_end() finish accessing variable arguments
va_start() start accessing variable arguments

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 doesn't 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.

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're 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're 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're 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.

The Classification section also indicates whether or not it's safe to use the function:

Caveats:

This optional subsection gives warnings about the function.

See Also:

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


[Previous]
[Contents]
[Next]