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

puts.3p (3983B)


  1. '\" et
  2. .TH PUTS "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. puts
  12. \(em put a string on standard output
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. #include <stdio.h>
  17. .P
  18. int puts(const char *\fIs\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. \fIputs\fR()
  27. function shall write the string pointed to by
  28. .IR s ,
  29. followed by a
  30. <newline>,
  31. to the standard output stream
  32. .IR stdout .
  33. The terminating null byte shall not be written.
  34. .P
  35. The last data modification and last file status change timestamps
  36. of the file shall be marked for update between the successful
  37. execution of
  38. \fIputs\fR()
  39. and the next successful completion of a call to
  40. \fIfflush\fR()
  41. or
  42. \fIfclose\fR()
  43. on the same stream or a call to
  44. \fIexit\fR()
  45. or
  46. \fIabort\fR().
  47. .SH "RETURN VALUE"
  48. Upon successful completion,
  49. \fIputs\fR()
  50. shall return a non-negative number. Otherwise, it shall return EOF,
  51. shall set an error indicator for the stream,
  52. and
  53. .IR errno
  54. shall be set to indicate the error.
  55. .SH ERRORS
  56. Refer to
  57. .IR "\fIfputc\fR\^(\|)".
  58. .LP
  59. .IR "The following sections are informative."
  60. .SH EXAMPLES
  61. .SS "Printing to Standard Output"
  62. .P
  63. The following example gets the current time, converts it to a string
  64. using
  65. \fIlocaltime\fR()
  66. and
  67. \fIasctime\fR(),
  68. and prints it to standard output using
  69. \fIputs\fR().
  70. It then prints the number of minutes to an event for which it is
  71. waiting.
  72. .sp
  73. .RS 4
  74. .nf
  75. #include <time.h>
  76. #include <stdio.h>
  77. \&...
  78. time_t now;
  79. int minutes_to_event;
  80. \&...
  81. time(&now);
  82. printf("The time is ");
  83. puts(asctime(localtime(&now)));
  84. printf("There are %d minutes to the event.\en",
  85. minutes_to_event);
  86. \&...
  87. .fi
  88. .P
  89. .RE
  90. .SH "APPLICATION USAGE"
  91. The
  92. \fIputs\fR()
  93. function appends a
  94. <newline>,
  95. while
  96. \fIfputs\fR()
  97. does not.
  98. .P
  99. This volume of POSIX.1\(hy2017 requires that successful completion simply return a non-negative
  100. integer. There are at least three known different implementation
  101. conventions for this requirement:
  102. .IP " *" 4
  103. Return a constant value.
  104. .IP " *" 4
  105. Return the last character written.
  106. .IP " *" 4
  107. Return the number of bytes written. Note that this implementation
  108. convention cannot be adhered to for strings longer than
  109. {INT_MAX}
  110. bytes as the value would not be representable in the return type of the
  111. function. For backwards compatibility, implementations can return the
  112. number of bytes for strings of up to
  113. {INT_MAX}
  114. bytes, and return
  115. {INT_MAX}
  116. for all longer strings.
  117. .SH RATIONALE
  118. None.
  119. .SH "FUTURE DIRECTIONS"
  120. None.
  121. .SH "SEE ALSO"
  122. .IR "Section 2.5" ", " "Standard I/O Streams",
  123. .IR "\fIfopen\fR\^(\|)",
  124. .IR "\fIfputs\fR\^(\|)",
  125. .IR "\fIputc\fR\^(\|)"
  126. .P
  127. The Base Definitions volume of POSIX.1\(hy2017,
  128. .IR "\fB<stdio.h>\fP"
  129. .\"
  130. .SH COPYRIGHT
  131. Portions of this text are reprinted and reproduced in electronic form
  132. from IEEE Std 1003.1-2017, Standard for Information Technology
  133. -- Portable Operating System Interface (POSIX), The Open Group Base
  134. Specifications Issue 7, 2018 Edition,
  135. Copyright (C) 2018 by the Institute of
  136. Electrical and Electronics Engineers, Inc and The Open Group.
  137. In the event of any discrepancy between this version and the original IEEE and
  138. The Open Group Standard, the original IEEE and The Open Group Standard
  139. is the referee document. The original Standard can be obtained online at
  140. http://www.opengroup.org/unix/online.html .
  141. .PP
  142. Any typographical or formatting errors that appear
  143. in this page are most likely
  144. to have been introduced during the conversion of the source files to
  145. man page format. To report such errors, see
  146. https://www.kernel.org/doc/man-pages/reporting_bugs.html .