Fixed compatibility of output.
[AROS.git] / test / misc / iffparsewrite.c
blob0a02197401f06f2d7b8104ca173d5bb92a57cae6
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <proto/exec.h>
7 #include <proto/dos.h>
8 #include <proto/iffparse.h>
9 #include <dos/dos.h>
10 #include <libraries/iffparse.h>
11 #include <datatypes/pictureclass.h>
13 #include <stdio.h>
14 #include <string.h>
15 #include <stdlib.h>
17 struct Library *IFFParseBase;
19 static struct IFFHandle *iff;
20 static LONG err;
22 int main(void)
24 IFFParseBase = OpenLibrary("iffparse.library",0);
25 if (!IFFParseBase)
27 printf("Could not open iffparse.library!");
28 exit(0);
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)))
37 InitIFFasDOS(iff);
39 err = OpenIFF(iff, IFFF_WRITE);
40 if (err == 0)
42 err = PushChunk(iff, ID_ILBM, ID_FORM, IFFSIZE_UNKNOWN);
43 if (err == 0)
45 err = PushChunk(iff, ID_ILBM, MAKE_ID('A', 'B', 'C', 'D'), IFFSIZE_UNKNOWN);
46 if (err == 0)
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);
57 PopChunk(iff);
59 } else printf("PushChunk(iff, ID_ILBM, MAKE_ID('A', 'B', 'C', 'D'), IFFSIZE_UNKNOWN) returned error %ld\n",(long)err);
61 PopChunk(iff);
63 } else printf("PushChunk(iff, ID_ILBM, ID_FORM, IFFSIZE) returned error %ld\n",(long)err);
65 CloseIFF(iff);
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");
73 FreeIFF(iff);
75 } else printf("AllocIFF failed!\n");
77 CloseLibrary(IFFParseBase);
79 return 0;