1UNGETC(P)                  POSIX Programmer's Manual                 UNGETC(P)
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 shall push the byte specified by c (converted to
16       an unsigned char) back onto the input stream pointed to by stream.  The
17       pushed-back  bytes shall 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(), fsetpos(), or rewind()) shall discard  any  pushed-back  bytes
21       for  the stream. The external storage corresponding to the stream shall
22       be unchanged.
23
24       One byte of push-back shall be provided. If ungetc() is called too many
25       times  on the same stream without an intervening read or file-positionā€
26       ing operation on that stream, the operation may fail.
27
28       If the value of c equals that of the macro  EOF,  the  operation  shall
29       fail and the input stream shall be left unchanged.
30
31       A successful call to ungetc() shall clear the end-of-file indicator for
32       the stream. The value of the file-position  indicator  for  the  stream
33       after  reading or discarding all pushed-back bytes shall be the same as
34       it was before the bytes were pushed back. The  file-position  indicator
35       is  decremented by each successful call to ungetc(); if its value was 0
36       before a call, its value is unspecified after the call.
37

RETURN VALUE

39       Upon successful completion, ungetc() shall return the byte pushed  back
40       after conversion. Otherwise, it shall return EOF.
41

ERRORS

43       No errors are defined.
44
45       The following sections are informative.
46

EXAMPLES

48       None.
49

APPLICATION USAGE

51       None.
52

RATIONALE

54       None.
55

FUTURE DIRECTIONS

57       None.
58

SEE ALSO

60       fseek()  , getc() , fsetpos() , read() , rewind() , setbuf() , the Base
61       Definitions volume of IEEE Std 1003.1-2001, <stdio.h>
62
64       Portions of this text are reprinted and reproduced in  electronic  form
65       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
66       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
67       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
68       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
69       event of any discrepancy between this version and the original IEEE and
70       The Open Group Standard, the original IEEE and The Open Group  Standard
71       is  the  referee document. The original Standard can be obtained online
72       at http://www.opengroup.org/unix/online.html .
73
74
75
76IEEE/The Open Group                  2003                            UNGETC(P)
Impressum