[comp.sys.amiga.tech] Bug in Lattice C 5.04?

mfg@castle.ed.ac.uk (M Gordon) (05/31/90)

I have recently started looking at IFF files and the following is the beginningsof a very simple IFF reader. Unfortunately it won't compile - no warnings or
error messages except CXERR 99. Since the compiler internal errors in the
manual only go up to about 35 I am totally stuck.
The program is so simple that someone must have seen this bug before. What can
I do to get around it?

--------------------------------------------------------------------------------
typedef union {
	char chid[4];
	long id;
} ID;

typedef struct {
	ID ckID;
	long ckSize;
} ckHeader;


#include <stdio.h>

void printID(ID idu)
{
	putchar(idu.chid[0]);
	putchar(idu.chid[1]);
	putchar(idu.chid[2]);
	putchar(idu.chid[3]);
}

main(int argc,char **argv)
{
	FILE *in;
	ckHeader header;
	ID type;

	if (argc!=2)
	{
		fprintf(stderr,"usage: listiff filename\n");
		exit(1);
	}

	if ((in=fopen(argv[1],"r"))==NULL)
	{
		perror(argv[1]);
		exit(1);
	}

	fread((char *)&header,sizeof(header),1,in);

	printID(header.ckID);
	printf(" %ld bytes\n ",header.ckSize);

	fread((char *)&type,sizeof(type),1,in);
	printID(type);
}

-- 
							 _   _   _    _   _	
Michael Gordon - mfg@castle.ed.ac.uk OR ee.ed.ac.uk	| |_| |_| |__| |_| |   
							| . . . .      . . |    
I spilt spot remover on my dog and now he's gone! 	|_________|~~|_____|