2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
6 #include <proto/exec.h>
8 #include <proto/iffparse.h>
10 #include <libraries/iffparse.h>
11 #include <datatypes/pictureclass.h>
17 struct Library
*IFFParseBase
;
19 static struct IFFHandle
*iff
;
24 IFFParseBase
= OpenLibrary("iffparse.library",0);
27 printf("Could not open iffparse.library!");
31 printf("Trying to write a test file called \"ram:test.iff\" ...\n\n");
33 if ((iff
= AllocIFF()))
35 if ((iff
->iff_Stream
= (IPTR
) Open("ram:test.iff", MODE_NEWFILE
)))
39 err
= OpenIFF(iff
, IFFF_WRITE
);
42 err
= PushChunk(iff
, ID_ILBM
, ID_FORM
, IFFSIZE_UNKNOWN
);
45 err
= PushChunk(iff
, ID_ILBM
, MAKE_ID('A', 'B', 'C', 'D'), IFFSIZE_UNKNOWN
);
48 char *buffer
= "1234567890";
50 err
= WriteChunkBytes(iff
, buffer
, strlen(buffer
));
51 if (err
== strlen(buffer
))
53 printf("********* No errors during writing :-) **************\n");
55 } else printf("WriteChunkBytes(iff, buffer, strlen(buffer)) returned %ld\n",(long)err
);
59 } else printf("PushChunk(iff, ID_ILBM, MAKE_ID('A', 'B', 'C', 'D'), IFFSIZE_UNKNOWN) returned error %ld\n",(long)err
);
63 } else printf("PushChunk(iff, ID_ILBM, ID_FORM, IFFSIZE) returned error %ld\n",(long)err
);
67 } else printf("OpenIFF returned error %ld\n",(long)err
);
69 Close((BPTR
) iff
->iff_Stream
);
71 } else printf("Could not open ram:test.iff for write!\n");
75 } else printf("AllocIFF failed!\n");
77 CloseLibrary(IFFParseBase
);