HEX and NUMBER switches now work again. AutoDoc fixes.
[tangerine.git] / test / iffparsewrite.c
blob12ef87c617cb43df2b7fb4fe51036a1e73e1bf4c
1 #include <proto/exec.h>
2 #include <proto/dos.h>
3 #include <proto/iffparse.h>
4 #include <dos/dos.h>
5 #include <libraries/iffparse.h>
6 #include <datatypes/pictureclass.h>
8 #include <stdio.h>
9 #include <string.h>
10 #include <stdlib.h>
12 struct Library *IFFParseBase;
14 static struct IFFHandle *iff;
15 static LONG err;
17 int main(void)
19 IFFParseBase = OpenLibrary("iffparse.library",0);
20 if (!IFFParseBase)
22 printf("Could not open iffparse.library!");
23 exit(0);
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)))
32 InitIFFasDOS(iff);
34 err = OpenIFF(iff, IFFF_WRITE);
35 if (err == 0)
37 err = PushChunk(iff, ID_ILBM, ID_FORM, IFFSIZE_UNKNOWN);
38 if (err == 0)
40 err = PushChunk(iff, ID_ILBM, MAKE_ID('A', 'B', 'C', 'D'), IFFSIZE_UNKNOWN);
41 if (err == 0)
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);
52 PopChunk(iff);
54 } else printf("PushChunk(iff, ID_ILBM, MAKE_ID('A', 'B', 'C', 'D'), IFFSIZE_UNKNOWN) returned error %ld\n",err);
56 PopChunk(iff);
58 } else printf("PushChunk(iff, ID_ILBM, ID_FORM, IFFSIZE) returned error %ld\n",err);
60 CloseIFF(iff);
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");
68 FreeIFF(iff);
70 } else printf("AllocIFF failed!\n");
72 CloseLibrary(IFFParseBase);
74 return 0;