summaryrefslogtreecommitdiff
path: root/support/dktools/test-mbstr.ctr
blob: 36bd737fb7db9f6ab8f53ffba7acb03b15c4d4da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

#include "dk4conf.h"
#include "dk4strm.h"
#include "dk4membuf.h"
#include "dk4mbstrm.h"


static const char test[] = { "0123456789ABCDEF" };

int main(int argc, char *argv[])
{
	dk4_membuf_t	*mb		= NULL;
	dk4_stream_t	*strm	= NULL;
	size_t			 i;

	mb = dk4membuf_open(NULL);
	if (NULL != mb) {
		strm = dk4stream_open_membuf_writer(mb, NULL);
		if (NULL != strm) {
			for (i = 0; i < 1024; i++) {
				dk4stream_write(strm, test, 16, NULL);
			}
			if (dk4membuf_size(&i, mb, NULL)) {
				printf("Bytes: %lu\n", (unsigned long)i);
			}
			dk4stream_close(strm, NULL);
		}
		else {
		}
		dk4membuf_close(mb);
	}
	else {
	}

	return 0;
}

/* vim: set ai sw=4 ts=4 : */