logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

ungetc.3p (3698B)


  1. '\" et
  2. .TH UNGETC "3P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. ungetc
  12. \(em push byte back into input stream
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. #include <stdio.h>
  17. .P
  18. int ungetc(int \fIc\fP, FILE *\fIstream\fP);
  19. .fi
  20. .SH DESCRIPTION
  21. The functionality described on this reference page is aligned with the
  22. ISO\ C standard. Any conflict between the requirements described here and the
  23. ISO\ C standard is unintentional. This volume of POSIX.1\(hy2017 defers to the ISO\ C standard.
  24. .P
  25. The
  26. \fIungetc\fR()
  27. function shall push the byte specified by
  28. .IR c
  29. (converted to an
  30. .BR "unsigned char" )
  31. back onto the input stream pointed to by
  32. .IR stream .
  33. The pushed-back bytes shall be returned by subsequent reads on that
  34. stream in the reverse order of their pushing. A successful intervening
  35. call (with the stream pointed to by
  36. .IR stream )
  37. to a file-positioning function (\c
  38. \fIfseek\fR(),
  39. \c
  40. \fIfseeko\fR(),
  41. \fIfsetpos\fR(),
  42. or
  43. \fIrewind\fR())
  44. or
  45. \fIfflush\fR()
  46. shall discard any pushed-back bytes for the stream. The external
  47. storage corresponding to the stream shall be unchanged.
  48. .P
  49. One byte of push-back shall be provided. If
  50. \fIungetc\fR()
  51. is called too many times on the same stream without an intervening read
  52. or file-positioning operation on that stream, the operation may fail.
  53. .P
  54. If the value of
  55. .IR c
  56. equals that of the macro EOF, the operation shall fail and the input
  57. stream shall be left unchanged.
  58. .P
  59. A successful call to
  60. \fIungetc\fR()
  61. shall clear the end-of-file indicator for the stream. The value of the
  62. file-position indicator for the stream after all pushed-back bytes have
  63. been read, or discarded by calling
  64. \fIfseek\fR(),
  65. \fIfseeko\fR(),
  66. \fIfsetpos\fR(),
  67. or
  68. \fIrewind\fR()
  69. (but not
  70. \fIfflush\fR()),
  71. shall be the same as it was before the bytes were pushed back. The
  72. file-position indicator is decremented by each successful call to
  73. \fIungetc\fR();
  74. if its value was 0 before a call, its value is unspecified after the call.
  75. .SH "RETURN VALUE"
  76. Upon successful completion,
  77. \fIungetc\fR()
  78. shall return the byte pushed back after conversion. Otherwise, it
  79. shall return EOF.
  80. .SH ERRORS
  81. No errors are defined.
  82. .LP
  83. .IR "The following sections are informative."
  84. .SH EXAMPLES
  85. None.
  86. .SH "APPLICATION USAGE"
  87. None.
  88. .SH RATIONALE
  89. None.
  90. .SH "FUTURE DIRECTIONS"
  91. None.
  92. .SH "SEE ALSO"
  93. .IR "Section 2.5" ", " "Standard I/O Streams",
  94. .IR "\fIfseek\fR\^(\|)",
  95. .IR "\fIgetc\fR\^(\|)",
  96. .IR "\fIfsetpos\fR\^(\|)",
  97. .IR "\fIread\fR\^(\|)",
  98. .IR "\fIrewind\fR\^(\|)",
  99. .IR "\fIsetbuf\fR\^(\|)"
  100. .P
  101. The Base Definitions volume of POSIX.1\(hy2017,
  102. .IR "\fB<stdio.h>\fP"
  103. .\"
  104. .SH COPYRIGHT
  105. Portions of this text are reprinted and reproduced in electronic form
  106. from IEEE Std 1003.1-2017, Standard for Information Technology
  107. -- Portable Operating System Interface (POSIX), The Open Group Base
  108. Specifications Issue 7, 2018 Edition,
  109. Copyright (C) 2018 by the Institute of
  110. Electrical and Electronics Engineers, Inc and The Open Group.
  111. In the event of any discrepancy between this version and the original IEEE and
  112. The Open Group Standard, the original IEEE and The Open Group Standard
  113. is the referee document. The original Standard can be obtained online at
  114. http://www.opengroup.org/unix/online.html .
  115. .PP
  116. Any typographical or formatting errors that appear
  117. in this page are most likely
  118. to have been introduced during the conversion of the source files to
  119. man page format. To report such errors, see
  120. https://www.kernel.org/doc/man-pages/reporting_bugs.html .