section 7.8.3: Ungetc

There's not much more to say about ungetc, but two more stdio functions which might deserve mention are fread and fwrite.

getc and putc (and getchar and putchar) allow you to read and write a character at a time, while fgets and fputs read and write a line at a time. The printf family of routines does formatted output, and the scanf family does formatted input. But what if you want to read or write a big block of unformatted characters, not necessarily one line long? You could use getc or putc in a loop, but another solution is to use the fread and fwrite functions, which are (briefly) described in appendix B1.5 on page 247.

Read sequentially: prev next up top

This page by Steve Summit // Copyright 1995, 1996 // mail feedback