2 * c_iff - a portable IFF-parser
4 * Copyright (C) 2000, 2001 Joerg Dietrich
6 * This is the AROS-version of c_iff.
7 * It is distributed under the AROS Public License.
8 * But I reserve the right to distribute
9 * my own version under other licenses.
13 * example.c - shows how to use c_iff
24 * include c_iff.h when you want to use c_iff
33 void PrintID(uint32_t ID
);
39 int main(int argc
, char **argv
)
42 * struct IFFHandle is the basic struct of c_iff.
48 fprintf(stderr
, "usage: %s IFF-file\n", argv
[0]);
54 * OpenIFF() is used to open an existing IFF
69 * Read the header of the next chunk.
71 if(!ReadChunkHeader(IH
))
81 * If you are not interessted in the Data, skip it with SkipChunkData() .
82 * If you need the Data use ReadChunkData() .
88 * Alway close an IFF with CloseIFF() !
93 * Use NewIFF() to open a new IFF for writing.
95 IH
=NewIFF("test1.iff", MAKE_ID('A','N','I','M'));
102 * Open a new SubFORM, an IFF inside an IFF.
104 if(NewSubFORM(IH
, MAKE_ID('I','L','B','M')))
109 if(NewChunk(IH
, MAKE_ID('F','V','E','R')))
112 * Write some data to the chunk.
113 * The chunk-sizes are automatically fixed.
115 WriteChunkData(IH
, "$VER: test1 1.10", 17);
118 * You must always end a chunk with EndChunk() .
123 if(NewChunk(IH
, MAKE_ID('A','U','T','H')))
125 WriteChunkData(IH
, "Joerg Dietrich", 13);
130 * EndChunk is used too, to end a SubFORM.
136 * And always close your IFF.
142 void PrintID(uint32_t ID
)
146 Buffer
[0]=(ID
&0xFF000000)>>24;
147 Buffer
[1]=(ID
&0xFF0000) >>16;
148 Buffer
[2]=(ID
&0xFF00) >> 8;
152 printf("%s", Buffer
);