aded buffer_getc, buffer_getn get n bytes less only if EOF and
buffer_get_token for getting n bytes till finding a termination char or EOF/error.
This commit is contained in:
12
buffer/buffer_getc.c
Normal file
12
buffer/buffer_getc.c
Normal file
@@ -0,0 +1,12 @@
|
||||
#include "byte.h"
|
||||
#include "buffer.h"
|
||||
|
||||
int buffer_getc(buffer* b,char* x) {
|
||||
if (b->p==b->n) {
|
||||
register int blen;
|
||||
if ((blen=buffer_feed(b))<=0) return blen;
|
||||
}
|
||||
*x=b->x[b->p];
|
||||
++b->p;
|
||||
return 1;
|
||||
}
|
||||
Reference in New Issue
Block a user