1.\" Copyright (c) 1990, 1991 The Regents of the University of California. 2.\" All rights reserved. 3.\" 4.\" This code is derived from software contributed to Berkeley by 5.\" Chris Torek. 6.\" %sccs.include.redist.man% 7.\" 8.\" @(#)putc.3 6.6 (Berkeley) 04/19/91 9.\" 10.Dd 11.Dt PUTC 3 12.Os 13.Sh NAME 14.Nm fputc , 15.Nm putc , 16.Nm putchar , 17.Nm putw 18.Nd output a character or word to a stream 19.Sh SYNOPSIS 20.Fd #include <stdio.h> 21.Ft int 22.Fn fputc "int c" "FILE *stream" 23.Ft int 24.Fn putc "int c" "FILE *stream" 25.Ft int 26.Fn putchar "int c" 27.Ft int 28.Fn putw "int w" "FILE *stream" 29.Sh DESCRIPTION 30The 31.Fn fputc 32function 33writes the character 34.Fa c 35(converted to an ``unsigned char'') 36to the output stream pointed to by 37.Fa stream . 38.Pp 39.Fn Putc 40acts essentially identically to 41.Fn fputc , 42but is a macro that expands in-line. It may evaluate 43.Fa stream 44more than once, so arguments given to 45.Fn putc 46should not be expressions with potential side effects. 47.Pp 48.Fn Putchar 49is identical to 50.Fn putc 51with an output stream of 52.Em stdout . 53.Pp 54The 55.Fn putw 56function 57writes the specified 58.Em int 59to the named output 60.Fa stream . 61.Sh RETURN VALUES 62The functions, 63.Fn fputc , 64.Fn putc 65and 66.Fn putchar 67return the character written. 68If an error occurs, the value 69.Dv EOF 70is returned. 71The 72.Fn putw 73function 74returns 0 on success; 75.Dv EOF 76is returned if 77a write error occurs, 78or if an attempt is made to write a read-only stream. 79.Sh SEE ALSO 80.Xr ferror 3 , 81.Xr fopen 3 , 82.Xr getc 3 , 83.Xr stdio 3 84.Sh STANDARDS 85The functions 86.Fn fputc , 87.Fn putc , 88and 89.Fn putchar , 90conform to 91.St -ansiC . 92A function 93.Fn putw 94function appeared in 95.At v6 . 96.Sh BUGS 97The size and byte order of an 98.Em int 99varies from one machine to another, and 100.Fn putw 101is not recommended for portable applications. 102