Chapter 10. Conversion Functions

The need for data conversions is always present within an application program. Arithmetic is performed using int, float, and double types because it is efficient and convenient. The same data must then be converted into ASCII strings in order for it to be displayed on a terminal. Data input also must undergo conversions.

In this chapter, you will examine

  • The atoi(3), atol(3), and atof(3) family

  • The sscanf(3) function

  • The strtol(3) and strtoul(3) functions

  • The strtod(3) function

All of these functions concern themselves with conversion from ASCII to a numeric C data type.

Get Advanced UNIX Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.