|
|
1.1 root 1: .th PUTC III 6/12/72
2: .sh NAME
3: putc \*- buffered output
4: .sh SYNOPSIS
5: .ft B
6: .nf
7: mov $filename,r0
8: jsr r5,fcreat; iobuf
9: .s3
10: fcreat(file, iobuf)
11: char *file;
12: struct buf *iobuf;
13: .s3
14: .ft R
15: (get byte in r0)
16: .ft B
17: jsr r5,putc; iobuf
18: .s3
19: putc(c, iobuf)
20: int c;
21: struct buf *iobuf;
22: .s3
23: .ft R
24: (get word in r0)
25: .ft B
26: jsr r5,putw; iobuf
27: .s3
28: [putw not available from C]
29: .s3
30: jsr r5,flush; iobuf
31: .s3
32: fflush(iobuf)
33: struct buf *iobuf;
34: .fi
35: .ft R
36: .sh DESCRIPTION
37: .it Fcreat
38: creates
39: the given file (mode 666) and sets up the buffer
40: .it iobuf
41: (size 518 bytes);
42: .it putc
43: and
44: .it putw
45: write a byte or word respectively
46: onto the file;
47: .it flush
48: forces the contents of the buffer to be written, but
49: does not close the file.
50: The format of the buffer is:
51: .s3
52: .nf
53: .ft B
54: iobuf: .=.+2 / file descriptor
55: .=.+2 / characters unused in buffer
56: .=.+2 / ptr to next free character
57: .=.+512. / buffer
58: .ft R
59: .s3
60: Or in C,
61: .s3
62: .ft B
63: .nf
64: struct buf {
65: int fildes;
66: int nunused;
67: char *nxtfree;
68: char buff[512];
69: };
70: .ft R
71: .fi
72: .s3
73: .it Fcreat
74: sets the error bit (c-bit) if the
75: file creation failed (from C, returns \*-1); none of the other routines
76: returns error information.
77: .s3
78: Before terminating, a program should call
79: .it flush
80: to force out the last of the output
81: .it (fflush
82: from C).
83: .s3
84: The user must supply
85: .it iobuf,
86: which should begin on a word boundary.
87: .s3
88: To write a new file using the same buffer, it
89: suffices to call
90: .it [f]flush,
91: close the file,
92: and
93: call
94: .it fcreat
95: again.
96: .sh "SEE ALSO"
97: creat(II), write(II), getc(III)
98: .sh DIAGNOSTICS
99: error bit possible
100: on
101: .it fcreat
102: call.
103: .sh BUGS
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.