O'Reilly logo

C in a Nutshell by Tony Crawford, Peter Prinz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 16. 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 17, which explains them in alphabetical order, with examples.

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 16-1 lists general file access functions declared in the header stdio.h.

Table 16-1. General file access functions

Purpose

Functions

Rename a file, delete a file

rename(), remove()

Create and/or open a file

fopen(), freopen(), tmpfile()

Close a file

fclose()

Generate a unique filename

tmpnam()

Query or clear file access flags

feof(), ferror(), clearerr()

Query the current file access position

ftell(), fgetpos()

Change the current file access position

rewind(), fseek(), fsetpos()

Write buffer contents to file

fflush()

Control file buffering

setbuf(), setvbuf()

There are two complete sets of functions for input and output of characters and strings: the byte-character and the wide-character I/O functions (see "Byte-Oriented and Wide-Oriented Streams" in Chapter 13 for more information). The wide-character functions operate ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required