Exemplo n.º 1
0
/// Check that tags match
static inline bool CheckMatchingToken (const char* tag, StringBuffer* buf, FILE* f)
{
	int l = 1+strlen(tag);
	buf = SetStringBufferLength (buf, l);
	if (buf==NULL) {
		return false;
	}
	fread(buf->c, sizeof(char), l, f);

	if (strcmp(tag,buf->c)) {
		fprintf (stderr, "Expected tag <%s>, found <%s>.\n", tag, buf->c);
		return false;
	}
	return true;
}
Exemplo n.º 2
0
/// Check that tags match
static inline bool CheckMatchingToken (const char* tag, StringBuffer* buf, FILE* f)
{
	int unsigned l = 1+strlen(tag);
	size_t sizeRead;
	buf = SetStringBufferLength (buf, l);
	if (buf==NULL) {
		return false;
	}
	sizeRead = fread(buf->c, sizeof(char), l, f);
	if( sizeRead != l)
	{
		fprintf(stderr, "Not all %d bytes are read correctly", l );
	}

	if (strcmp(tag,buf->c)) {
		fprintf (stderr, "Expected tag <%s>, found <%s>.\n", tag, buf->c);
		return false;
	}
	return true;
}