1*61180Sbostic.\" Copyright (c) 1990, 1991, 1993 2*61180Sbostic.\" The Regents of the University of California. All rights reserved. 320361Smckusick.\" 446096Sbostic.\" This code is derived from software contributed to Berkeley by 550297Sbostic.\" Chris Torek and the American National Standards Committee X3, 650297Sbostic.\" on Information Processing Systems. 750297Sbostic.\" 846096Sbostic.\" %sccs.include.redist.man% 946096Sbostic.\" 10*61180Sbostic.\" @(#)putc.3 8.1 (Berkeley) 06/04/93 1146096Sbostic.\" 1248351Scael.Dd 1348351Scael.Dt PUTC 3 1448351Scael.Os 1548351Scael.Sh NAME 1648351Scael.Nm fputc , 1748351Scael.Nm putc , 1848351Scael.Nm putchar , 1948351Scael.Nm putw 2048351Scael.Nd output a character or word to a stream 2148351Scael.Sh SYNOPSIS 2248351Scael.Fd #include <stdio.h> 2348351Scael.Ft int 2448351Scael.Fn fputc "int c" "FILE *stream" 2548351Scael.Ft int 2648351Scael.Fn putc "int c" "FILE *stream" 2748351Scael.Ft int 2848351Scael.Fn putchar "int c" 2948351Scael.Ft int 3048351Scael.Fn putw "int w" "FILE *stream" 3148351Scael.Sh DESCRIPTION 3248351ScaelThe 3348351Scael.Fn fputc 3448351Scaelfunction 3546096Sbosticwrites the character 3648351Scael.Fa c 3746096Sbostic(converted to an ``unsigned char'') 3848351Scaelto the output stream pointed to by 3948351Scael.Fa stream . 4048351Scael.Pp 4148351Scael.Fn Putc 4246096Sbosticacts essentially identically to 4348351Scael.Fn fputc , 4448351Scaelbut is a macro that expands in-line. It may evaluate 4548351Scael.Fa stream 4648351Scaelmore than once, so arguments given to 4748351Scael.Fn putc 4848351Scaelshould not be expressions with potential side effects. 4948351Scael.Pp 5048351Scael.Fn Putchar 5146096Sbosticis identical to 5248351Scael.Fn putc 5346096Sbosticwith an output stream of 5448351Scael.Em stdout . 5548351Scael.Pp 5648351ScaelThe 5748351Scael.Fn putw 5848351Scaelfunction 5946096Sbosticwrites the specified 6048351Scael.Em int 6146096Sbosticto the named output 6248351Scael.Fa stream . 6348351Scael.Sh RETURN VALUES 6448351ScaelThe functions, 6548351Scael.Fn fputc , 6648351Scael.Fn putc 6748351Scaeland 6848351Scael.Fn putchar 6948351Scaelreturn the character written. 7048351ScaelIf an error occurs, the value 7148351Scael.Dv EOF 7248351Scaelis returned. 7348351ScaelThe 7448351Scael.Fn putw 7548351Scaelfunction 7648351Scaelreturns 0 on success; 7748351Scael.Dv EOF 7848351Scaelis returned if 7948351Scaela write error occurs, 8046096Sbosticor if an attempt is made to write a read-only stream. 8148351Scael.Sh SEE ALSO 8248351Scael.Xr ferror 3 , 8348351Scael.Xr fopen 3 , 8448351Scael.Xr getc 3 , 8548351Scael.Xr stdio 3 8648351Scael.Sh STANDARDS 8748351ScaelThe functions 8848351Scael.Fn fputc , 8948351Scael.Fn putc , 9048351Scaeland 9148351Scael.Fn putchar , 9248351Scaelconform to 9348351Scael.St -ansiC . 9448351ScaelA function 9548351Scael.Fn putw 9648351Scaelfunction appeared in 9748351Scael.At v6 . 9848351Scael.Sh BUGS 9946096SbosticThe size and byte order of an 10048351Scael.Em int 10146096Sbosticvaries from one machine to another, and 10248351Scael.Fn putw 10346096Sbosticis not recommended for portable applications. 104