Runtime Library Functions

"Never put off until run time what you can do at compile time." -- David Gries, in "Compiler Construction for Digital Computers", circa 1969.

The C RunTime Library

There are thousands of references relating to the Standard C RunTime Library. The two links below are the main links to Microsoft's documentation on their implementation of the Standard C Runtime Library.

C Runtime Library Reference
Routines by category

The descriptions below relate to some of the more popular functions of the runtime library. Details on each category of functions can be viewed by following the links to the online documentation. Most of the functions are ANSI compatible, but a few are OS (Windows) specific.


Argument Access (Function Parameters)

#include <stdarg.h> 
The va_arg, va_end, and va_start macros provide access to function arguments when the number of arguments is variable. These macros are defined in STDARG.H for ANSI C compatibility, and in VARARGS.H for compatibility with UNIX System V.

Online documentation


Buffer Manipulation

#include <string.h>
These routines work with areas of memory on a byte-by-byte basis. You can copy blocks of memory from one buffer to another, search through memory, set entire blocks of memory to a specific value, etc.

Online documentation


Character Classification

#include <ctype.h>
Each of these routines tests a specified single-byte character, wide character, or multibyte character for satisfaction of a condition. (By definition, the ASCII character set is a subset of all multibyte-character sets. For example, Japanese katakana includes ASCII as well as non-ASCII characters.) Generally these routines execute faster than tests you might write.

Functionality includes: testing characters to see if they are numbers, lowercase, uppercase, whitespace, punctuation, hexadecimal, etc.

Online documentation


Data conversion

#include <stdlib.h>
These routines convert data from one form to another. Generally these routines execute faster than conversions you might write.

Funtionality includes: converting numbers to strings, strings to numbers, converting letters/strings to upper/lower case, converting characters to ASCII codes, etc.

Online documentation


Directory control

#include <direct.h>
These routines access, modify, and obtain information about the directory structure. That is, you can create directories, remove directories, change directories, search directories, get free disk space, etc.

This is not part of the ANSI Standard. (OS-specific routines.)

Online documentation


File handling

#include <io.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
Use these routines to create, delete, and manipulate files and to set and check file-access permissions.

Functionality includes: getting/setting a file's time and date, renaming files, deleting files, parsing paths into components, opening files for reading/writing, getting/setting file permissions, etc.

Some routines are not part of the ANSI Standard. (OS-specific routines.)

Online documentation


Floating-point support

#include <math.h>
These library routines provide support for math related functions such as: sin, cos, exp, floor, sqrt, log, rand, etc.

Online documentation


Input and output

#include <io.h>
#include <stdio.h>
#include <conio.h>
The I/O functions read and write data to and from files and devices. File I/O operations take place in text mode or binary mode. The functions from conio.h are Microsoft-specific functions.

Functionality includes: open/close files, seek, read/write characters or blocks, binary/text support, reading/writing to stdin, stdout, sterr, flushing files, etc.

Online documentation


Memory allocation

#include <stdlib.h>
These routines allocate, free, and reallocate memory.

Functionality includes: allocating, freeing (deallocating), initializing, reallocating, etc.

Online documentation


Process and environment control

#include <stdlib.h>
These routines start, stop, and manage processes from within a program. Use the environment-control routines to get and change information about the operating-system environment.

Functionality includes: aborting programs, exiting from processes, executing other programs, handling signals, etc.

Online documentation


Searching and sorting

#include <stdlib.h>
Functions for searching and sorting.

Functionality includes: linear search, binary search, and quick sort.

Online documentation


String manipulation

#include <string.h>
Functions that operate on NUL-terminated single-byte character, wide-character, and multibyte-character strings. Use the buffer-manipulation routines to work with character arrays that do not end with a NUL character

Functionality includes: searching strings for substrings and characters, concatenating strings, finding string lengths, comparing strings, setting characters of a string, etc.

Online documentation


Time management

#include <time.h>
Use these functions to get the current time and convert, adjust, and store it as necessary. The current time is the system time.

Functions include: getting the current system time, formatting data and time values, converting time formats, computing difference between two times, etc.

Online documentation