When I am trying to use the EA iffw.c library to write an IFF file, I can't get past the StartWGroup() call. It fails in IFFWriteBytes() because context->ckHdr.ckSize is zero. Inside IFFWriteBytes() there is an if() which checks that (size) != szNotYetKnown. (szNotYetKnown is a constant.) The example seems to indicate it should work, but I can't see how. IFFWriteBytes() returns CLIENT_ERROR because nBytes is 4 - I am trying to save a 32 bit int.
My failing code:
outfp = fopen(outfile, "wb");
ifferr = OpenWIFF(outfp, &filec, szNotYetKnown);
if (ifferr) {
return 2;
}
ifferr = StartWGroup(&filec, LIST, sizeof (ID_NATAMI_FLASH), ID_NATAMI_FLASH, &listc);
if (ifferr) {
printf("ifferr: %d\n", ifferr);
return 3;
}
The last fails, StartWGroup().
IFF is, like XML, simple enough that I could just generate it without a library, but it would be nice to make use a of once common and well tested library.
Question is not really about Amiga, but this file format was popular on Amiga. By the way, did you know DjVU, RMFF, AIFF, RIFF and many other formats are IFF or slight variations?
Update: easy to read IFF description.