Chapter 17. Functions at a Glance

This chapter lists the functions in the standard library according to their respective areas of application, describing shared features of the functions and their relationships to one another. This compilation might help you to find the right function for your purposes while programming.

Tip

The individual functions are described in detail in Chapter 18, which explains them in alphabetical order, with examples.

The alternative functions with bounds-checking introduced in C11, also called the secure functions, are listed in Tables 17-1 and 17-2. The names of these functions end with the suffix _s (s for “secure”), as in scanf_s(). Note that C implementations are not required to support the secure functions. For more information on using the secure functions, see “Functions with Bounds-Checking”.

Input and Output

We have dealt with this topic in detail in Chapter 13, which contains sections on I/O streams, sequential and random file access, formatted I/O, and error handling. A tabular list of the I/O functions will therefore suffice here. Table 17-1 lists general file access functions declared in the header stdio.h.

Table 17-1. General file access functions
Purpose Functions

Rename a file, delete a file

rename(), remove()

Create and/or open a file

fopen(), freopen(), tmpfile() fopen_s(), freopen_s(), tmpfile_s()

Close a file

fclose()

Generate a unique filename

tmpnam(), tmpnam_s()

Query or clear file access flags

feof(), ferror() ...

Get C in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.