Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 14. Formatting

14. Formatting

The standard C library functions printf, fprintf, and vprintf format data for output, and sprintf and vsprintf format data into strings. These functions are called with a format string and a list of arguments whose values are to be formatted. Formatting is controlled by conversion specifiers of the form %c embedded in the format string; the ith occurrence of %c describes how to format the ith argument in the list of arguments that follow the format string. The other characters are copied verbatim. For example, if name is the string Array and count is 8,

  sprintf(buf, "The %s interface has %d functions\n",
      name, count)


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint