#include <stdio.h>
#include <stdlib.h>
#include <src/csb.h>

int main(void) {
	csb_buf *buf;
	int retval = 0;
	FILE *fptr = fopen("test10.data", "rb");
	
	if (fptr == NULL) {
		return (1);
	}

	buf = csb_netstring_fromfile(fptr);
	if (buf == NULL) {
		return (1);
	}
	fclose(fptr);

	printf("buffer contains: %s\n", csb_cstring(buf));

	if (strcmp("Hello, world!", csb_cstring(buf)) != 0) {
		retval = 1;
		printf("ERROR READING\n");
	}

	csb_destroy(buf);
	return (retval);
}


syntax highlighted by Code2HTML, v. 0.9.1