1ungetc(3C)               Standard C Library Functions               ungetc(3C)
2
3
4

NAME

6       ungetc - push byte back into input stream
7

SYNOPSIS

9       #include <stdio.h>
10
11       int ungetc(int c, FILE *stream);
12
13

DESCRIPTION

15       The  ungetc()  function pushes the byte specified by c (converted to an
16       unsigned char) back onto the input stream pointed  to  by  stream.  The
17       pushed-back  bytes  will be returned by subsequent reads on that stream
18       in the reverse order of their pushing. A  successful  intervening  call
19       (with the stream pointed to by stream) to a file-positioning function (
20       fseek(3C), fsetpos(3C) or rewind(3C)) discards  any  pushed-back  bytes
21       for  the  stream.  The  external storage corresponding to the stream is
22       unchanged.
23
24
25       Four bytes of push-back are guaranteed.  If ungetc() is called too many
26       times  on the same stream without an intervening read or file-position‐
27       ing operation on that stream, the operation may fail.
28
29
30       If the value of c equals that of the macro EOF, the operation fails and
31       the input stream is unchanged.
32
33
34       A  successful call to ungetc() clears the end-of-file indicator for the
35       stream. The value of the file-position indicator for the  stream  after
36       reading  or discarding all pushed-back bytes will be the same as it was
37       before the bytes were  pushed  back.  The  file-position  indicator  is
38       decremented  by  each  successful  call to ungetc(); if its value was 0
39       before a call, its value is indeterminate after the call.
40

RETURN VALUES

42       Upon successful completion, ungetc() returns the byte pushed back after
43       conversion.  Otherwise it returns EOF.
44

ERRORS

46       No errors are defined.
47

ATTRIBUTES

49       See attributes(5) for descriptions of the following attributes:
50
51
52
53
54       ┌─────────────────────────────┬─────────────────────────────┐
55       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
56       ├─────────────────────────────┼─────────────────────────────┤
57       │Interface Stability          │Standard                     │
58       ├─────────────────────────────┼─────────────────────────────┤
59       │MT-Level                     │MT-Safe                      │
60       └─────────────────────────────┴─────────────────────────────┘
61

SEE ALSO

63       read(2), Intro(3), __fsetlocking(3C), fseek(3C), fsetpos(3C), getc(3C),
64       setbuf(3C), stdio(3C), attributes(5), standards(5)
65
66
67
68SunOS 5.11                        10 Sep 2003                       ungetc(3C)
Impressum