1*48351Scael.\" Copyright (c) 1990, 1991 The Regents of the University of California. 246096Sbostic.\" All rights reserved. 320361Smckusick.\" 446096Sbostic.\" This code is derived from software contributed to Berkeley by 546096Sbostic.\" Chris Torek. 646096Sbostic.\" %sccs.include.redist.man% 746096Sbostic.\" 8*48351Scael.\" @(#)putc.3 6.6 (Berkeley) 04/19/91 946096Sbostic.\" 10*48351Scael.Dd 11*48351Scael.Dt PUTC 3 12*48351Scael.Os 13*48351Scael.Sh NAME 14*48351Scael.Nm fputc , 15*48351Scael.Nm putc , 16*48351Scael.Nm putchar , 17*48351Scael.Nm putw 18*48351Scael.Nd output a character or word to a stream 19*48351Scael.Sh SYNOPSIS 20*48351Scael.Fd #include <stdio.h> 21*48351Scael.Ft int 22*48351Scael.Fn fputc "int c" "FILE *stream" 23*48351Scael.Ft int 24*48351Scael.Fn putc "int c" "FILE *stream" 25*48351Scael.Ft int 26*48351Scael.Fn putchar "int c" 27*48351Scael.Ft int 28*48351Scael.Fn putw "int w" "FILE *stream" 29*48351Scael.Sh DESCRIPTION 30*48351ScaelThe 31*48351Scael.Fn fputc 32*48351Scaelfunction 3346096Sbosticwrites the character 34*48351Scael.Fa c 3546096Sbostic(converted to an ``unsigned char'') 36*48351Scaelto the output stream pointed to by 37*48351Scael.Fa stream . 38*48351Scael.Pp 39*48351Scael.Fn Putc 4046096Sbosticacts essentially identically to 41*48351Scael.Fn fputc , 42*48351Scaelbut is a macro that expands in-line. It may evaluate 43*48351Scael.Fa stream 44*48351Scaelmore than once, so arguments given to 45*48351Scael.Fn putc 46*48351Scaelshould not be expressions with potential side effects. 47*48351Scael.Pp 48*48351Scael.Fn Putchar 4946096Sbosticis identical to 50*48351Scael.Fn putc 5146096Sbosticwith an output stream of 52*48351Scael.Em stdout . 53*48351Scael.Pp 54*48351ScaelThe 55*48351Scael.Fn putw 56*48351Scaelfunction 5746096Sbosticwrites the specified 58*48351Scael.Em int 5946096Sbosticto the named output 60*48351Scael.Fa stream . 61*48351Scael.Sh RETURN VALUES 62*48351ScaelThe functions, 63*48351Scael.Fn fputc , 64*48351Scael.Fn putc 65*48351Scaeland 66*48351Scael.Fn putchar 67*48351Scaelreturn the character written. 68*48351ScaelIf an error occurs, the value 69*48351Scael.Dv EOF 70*48351Scaelis returned. 71*48351ScaelThe 72*48351Scael.Fn putw 73*48351Scaelfunction 74*48351Scaelreturns 0 on success; 75*48351Scael.Dv EOF 76*48351Scaelis returned if 77*48351Scaela write error occurs, 7846096Sbosticor if an attempt is made to write a read-only stream. 79*48351Scael.Sh SEE ALSO 80*48351Scael.Xr ferror 3 , 81*48351Scael.Xr fopen 3 , 82*48351Scael.Xr getc 3 , 83*48351Scael.Xr stdio 3 84*48351Scael.Sh STANDARDS 85*48351ScaelThe functions 86*48351Scael.Fn fputc , 87*48351Scael.Fn putc , 88*48351Scaeland 89*48351Scael.Fn putchar , 90*48351Scaelconform to 91*48351Scael.St -ansiC . 92*48351ScaelA function 93*48351Scael.Fn putw 94*48351Scaelfunction appeared in 95*48351Scael.At v6 . 96*48351Scael.Sh BUGS 9746096SbosticThe size and byte order of an 98*48351Scael.Em int 9946096Sbosticvaries from one machine to another, and 100*48351Scael.Fn putw 10146096Sbosticis not recommended for portable applications. 102