1 #include <proto/exec.h>
3 #include <proto/iffparse.h>
5 #include <libraries/iffparse.h>
6 #include <datatypes/pictureclass.h>
12 struct Library
*IFFParseBase
;
14 static struct IFFHandle
*iff
;
19 IFFParseBase
= OpenLibrary("iffparse.library",0);
22 printf("Could not open iffparse.library!");
26 printf("Trying to write a test file called \"ram:test.iff\" ...\n\n");
28 if ((iff
= AllocIFF()))
30 if ((iff
->iff_Stream
= (IPTR
) Open("ram:test.iff", MODE_NEWFILE
)))
34 err
= OpenIFF(iff
, IFFF_WRITE
);
37 err
= PushChunk(iff
, ID_ILBM
, ID_FORM
, IFFSIZE_UNKNOWN
);
40 err
= PushChunk(iff
, ID_ILBM
, MAKE_ID('A', 'B', 'C', 'D'), IFFSIZE_UNKNOWN
);
43 char *buffer
= "1234567890";
45 err
= WriteChunkBytes(iff
, buffer
, strlen(buffer
));
46 if (err
== strlen(buffer
))
48 printf("********* No errors during writing :-) **************\n");
50 } else printf("WriteChunkBytes(iff, buffer, strlen(buffer)) returned %ld\n",err
);
54 } else printf("PushChunk(iff, ID_ILBM, MAKE_ID('A', 'B', 'C', 'D'), IFFSIZE_UNKNOWN) returned error %ld\n",err
);
58 } else printf("PushChunk(iff, ID_ILBM, ID_FORM, IFFSIZE) returned error %ld\n",err
);
62 } else printf("OpenIFF returned error %ld\n",err
);
64 Close((BPTR
) iff
->iff_Stream
);
66 } else printf("Could not open ram:test.iff for write!\n");
70 } else printf("AllocIFF failed!\n");
72 CloseLibrary(IFFParseBase
);