PWB1/usr/man/man3/putc.3

Compare this file to the similar file:
Show the results in this format:

.th PUTC III 5/31/77
.sh NAME
putc, putw, fcreat, fflush  \*-  buffered output
.sh SYNOPSIS
.ft B
.nf
mov	$filename,r0
jsr	r5,fcreat; iobuf
.s3
fcreat(file, iobuf)
char *file;
struct buf *iobuf;
.s3
.ft R
(get byte in r0)
.ft B
jsr	r5,putc; iobuf
.s3
putc(c, iobuf)
int c;
struct buf *iobuf;
.s3
.ft R
(get word in r0)
.ft B
jsr	r5,putw; iobuf
.s3
putw(w, iobuf);
.br
int w;
.br
struct buf *iobuf;
.s3
jsr	r5,flush; iobuf
.s3
fflush(iobuf)
struct buf *iobuf;
.fi
.ft R
.sh DESCRIPTION
.it Fcreat
creates
the given file (mode 666) and sets up the buffer
.it iobuf
(size 518 bytes);
.it putc
and
.it putw
write a byte or word respectively
onto the file;
.it flush
forces the contents of the buffer to be written, but
does not close the file.
The structure of the buffer is:
.nf
.ft B
.nf
struct buf {
	int fildes;	/* File descriptor */
	int nunused;	/* Remaining slots */
	char *xfree;	/* Ptr to next free slot */
	char buff[512];	/* The buffer */
};
.ft R
.s3
.fi
Before terminating, a program should call
.it flush
to force out the last of the output
.it (fflush
from C).
.s3
The user must supply
.it iobuf,
which should begin on a word boundary.
.s3
To write a new file using the same buffer, it
suffices to call
.it [f]flush,
close the file,
and
call
.it fcreat
again.
.s3
Use the new "Standard I/O" instead.
.sh "SEE ALSO"
creat(II), write(II), getc(III)
.br
.it "A New Input-Output Package"
by D. M. Ritchie.
.sh DIAGNOSTICS
.it Fcreat
sets the error bit (c-bit) if the 
file creation failed (from C, returns \*-1).
.it Putc
and
.it putw
return their character (word) argument.
In all calls 
.it errno
is set appropriately to 0 or to
a system error number.
See intro(II).