3 Bopen, Bfdopen, Binit, Binits, Brdline, Brdstr, Bgetc, Bgetrune, Bgetd, Bungetc, Bungetrune, Bread, Bseek, Boffset, Bfildes, Blinelen, Bputc, Bputrune, Bprint, Bvprint, Bwrite, Bflush, Bterm, Bbuffered \- buffered input/output
13 Biobuf* Bopen(char *file, int mode)
16 Biobuf* Bfdopen(int fd, int mode)
19 int Binit(Biobuf *bp, int fd, int mode)
22 int Binits(Biobufhdr *bp, int fd, int mode, uchar *buf, int size)
25 int Bterm(Biobufhdr *bp)
28 int Bprint(Biobufhdr *bp, char *format, ...)
31 int Bvprint(Biobufhdr *bp, char *format, va_list arglist);
34 void* Brdline(Biobufhdr *bp, int delim)
37 char* Brdstr(Biobufhdr *bp, int delim, int nulldelim)
40 int Blinelen(Biobufhdr *bp)
43 vlong Boffset(Biobufhdr *bp)
46 int Bfildes(Biobufhdr *bp)
49 int Bgetc(Biobufhdr *bp)
52 long Bgetrune(Biobufhdr *bp)
55 int Bgetd(Biobufhdr *bp, double *d)
58 int Bungetc(Biobufhdr *bp)
61 int Bungetrune(Biobufhdr *bp)
64 vlong Bseek(Biobufhdr *bp, vlong n, int type)
67 int Bputc(Biobufhdr *bp, int c)
70 int Bputrune(Biobufhdr *bp, long c)
73 long Bread(Biobufhdr *bp, void *addr, long nbytes)
76 long Bwrite(Biobufhdr *bp, void *addr, long nbytes)
79 int Bflush(Biobufhdr *bp)
82 int Bbuffered(Biobufhdr *bp)
85 These routines implement fast buffered I/O.
86 I/O on different file descriptors is independent.
100 allocates a buffer for the already-open file descriptor
108 to allocate a buffer.
111 initializes a standard size buffer, type
113 with the open file descriptor passed in
116 initializes a non-standard size buffer, type
118 with the open file descriptor,
119 buffer area, and buffer size passed in
124 are related by the declaration:
127 typedef struct Biobuf Biobuf;
131 uchar b[Bungetsize+Bsize];
136 of types pointer to Biobuf and pointer to Biobufhdr
137 can be used interchangeably in the following routines.
143 should be called before any of the
144 other routines on that buffer.
146 returns the integer file descriptor of the associated open file.
149 flushes the buffer for
151 If the buffer was allocated by
155 and the file is closed.
158 reads a string from the file associated with
160 up to and including the first
163 The delimiter character at the end of the line is
166 returns a pointer to the start of the line or
168 on end-of-file or read error.
170 returns the length (including the delimiter)
171 of the most recent string returned by
176 .IR malloc (3)-allocated
177 buffer containing the next line of input delimited by
179 terminated by a NUL (0) byte.
182 which returns when its buffer is full even if no delimiter has been found,
184 will return an arbitrarily long line in a single call.
187 is set, the terminal delimiter will be overwritten with a NUL.
188 After a successful call to
192 will be the length of the returned buffer, excluding the NUL.
195 returns the next character from
200 may be called immediately after
202 to allow the same character to be reread.
207 to read the bytes of the next
209 sequence in the input stream and returns the value of the rune
210 represented by the sequence.
211 It returns a negative value
214 may be called immediately after
218 sequence to be reread as either bytes or a rune.
222 may back up a maximum of five bytes.
231 to read the formatted
232 floating-point number in the input stream,
233 skipping initial blanks and tabs.
234 The value is stored in
242 into memory starting at
244 The number of bytes read is returned on success
245 and a negative value is returned if a read error occurred.
252 It returns the new file offset.
254 returns the file offset of the next character to be processed.
257 outputs the low order 8 bits of
263 to occur and there is an error,
264 a negative value is returned.
265 Otherwise, a zero is returned.
270 to output the low order
277 on the output stream.
280 is a buffered interface to
284 to occur and there is an error,
288 Otherwise, the number of bytes output is returned.
290 does the same except it takes as argument a
292 parameter, so it can be called within a variadic function.
303 to occur and there is an error,
304 a negative value is returned.
305 Otherwise, the number of bytes written is returned.
308 causes any buffered output associated with
315 exit for every buffer still open
319 returns the number of bytes in the buffer.
320 When reading, this is the number of bytes still available from the last
321 read on the file; when writing, it is the number of bytes ready to be
324 .B http://swtch.com/plan9port/unix
332 routines that return integers yield
336 is not the descriptor of an open file.
338 returns zero if the file cannot be opened in the given mode.
344 returns an error on strings longer than the buffer associated
346 and also if the end-of-file is encountered
349 will tell how many characters are available
351 In the case of a true end-of-file,
354 At the cost of allocating a buffer,
356 sidesteps these issues.
360 may be overwritten by calls to any other