Unix |
Unix v6 |
|
![]() |
putc(3) |
![]() |
putc, putw, fcreat, fflush buffered output
mov |
$filename,r0 |
|
jsr |
r5,fcreat; iobuf |
fcreat(file, iobuf)
char *file;
struct buf *iobuf;
(get byte in r0)
jsr |
r5,putc; iobuf |
putc(c, iobuf)
int c;
struct buf *iobuf;
(get word in r0)
jsr |
r5,putw; iobuf |
putw(w, iobuf);
int w;
struct buf *iobuf;
jsr |
r5,flush; iobuf |
fflush(iobuf)
struct buf *iobuf;
creates the given file (mode 666) and sets up the buffer
(size 518 bytes); and write a byte or word respectively onto
the file; forces the contents of the buffer to be written,
but does not close the file. The structure of the buffer is:
struct buf {
int fildes; |
/* File descriptor */ |
||||
int nunused; |
/* Remaining slots */ |
||||
char *xfree; |
/* Ptr to next free slot */ |
||||
char buff[512]; |
/* The buffer */ |
};
Before terminating, a program should call to force out the
last of the output from C). The user must supply which
should begin on a word boundary. To write a new file using
the same buffer, it suffices to call close the file, and
call again. creat (II), write (II), getc (III) sets the
error bit (c-bit) if the file creation failed (from C,
returns 1). and return their character (word) argument. In
all calls is set appropriately to 0 or to a system error
number. See introduction (II).
![]() |
putc(3) | ![]() |