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

getc.3p (2836B)


  1. '\" et
  2. .TH GETC "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. getc
  12. \(em get a byte from a stream
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. #include <stdio.h>
  17. .P
  18. int getc(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. \fIgetc\fR()
  27. function shall be equivalent to
  28. .IR "\fIfgetc\fR\^(\|)",
  29. except that if it is implemented as a macro it may evaluate
  30. .IR stream
  31. more than once, so the argument should never be an expression with
  32. side-effects.
  33. .SH "RETURN VALUE"
  34. Refer to
  35. .IR "\fIfgetc\fR\^(\|)".
  36. .SH ERRORS
  37. Refer to
  38. .IR "\fIfgetc\fR\^(\|)".
  39. .LP
  40. .IR "The following sections are informative."
  41. .SH EXAMPLES
  42. None.
  43. .SH "APPLICATION USAGE"
  44. If the integer value returned by
  45. \fIgetc\fR()
  46. is stored into a variable of type
  47. .BR char
  48. and then compared against the integer constant EOF, the comparison may
  49. never succeed, because sign-extension of a variable of type
  50. .BR char
  51. on widening to integer is implementation-defined.
  52. .P
  53. Since it may be implemented as a macro,
  54. \fIgetc\fR()
  55. may treat incorrectly a
  56. .IR stream
  57. argument with side-effects. In particular,
  58. .IR getc (* f \(pl\(pl)
  59. does not necessarily work as expected. Therefore, use of this function
  60. should be preceded by
  61. .BR \(dq#undef getc\(dq
  62. in such situations;
  63. \fIfgetc\fR()
  64. could also be used.
  65. .SH RATIONALE
  66. None.
  67. .SH "FUTURE DIRECTIONS"
  68. None.
  69. .SH "SEE ALSO"
  70. .IR "Section 2.5" ", " "Standard I/O Streams",
  71. .IR "\fIfgetc\fR\^(\|)"
  72. .P
  73. The Base Definitions volume of POSIX.1\(hy2017,
  74. .IR "\fB<stdio.h>\fP"
  75. .\"
  76. .SH COPYRIGHT
  77. Portions of this text are reprinted and reproduced in electronic form
  78. from IEEE Std 1003.1-2017, Standard for Information Technology
  79. -- Portable Operating System Interface (POSIX), The Open Group Base
  80. Specifications Issue 7, 2018 Edition,
  81. Copyright (C) 2018 by the Institute of
  82. Electrical and Electronics Engineers, Inc and The Open Group.
  83. In the event of any discrepancy between this version and the original IEEE and
  84. The Open Group Standard, the original IEEE and The Open Group Standard
  85. is the referee document. The original Standard can be obtained online at
  86. http://www.opengroup.org/unix/online.html .
  87. .PP
  88. Any typographical or formatting errors that appear
  89. in this page are most likely
  90. to have been introduced during the conversion of the source files to
  91. man page format. To report such errors, see
  92. https://www.kernel.org/doc/man-pages/reporting_bugs.html .