39 lines
557 B
C
39 lines
557 B
C
/*
|
|
* Copyright 2022 Oleg Borodin <borodin@unix7.org>
|
|
*/
|
|
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <fcntl.h>
|
|
|
|
#include <rcache.h>
|
|
#include <massert.h>
|
|
|
|
|
|
void test_getnc(void) {
|
|
|
|
int fd = open("test.json", O_RDONLY);
|
|
|
|
MASSERT(fd > 0);
|
|
|
|
rcache_t stream;
|
|
|
|
rcache_init(&stream, fd);
|
|
|
|
char c = rcache_getc(&stream);
|
|
|
|
printf("%c\n", c);
|
|
printf("%s", (char *)stream.data);
|
|
|
|
rcache_destroy(&stream);
|
|
}
|
|
|
|
|
|
int main(int argc, char** argv) {
|
|
(void)argc;
|
|
(void)argv;
|
|
test_getnc();
|
|
return 0;
|
|
}
|