Hi,
I´m trying to create a aiff to wave converter as a way to learn. So far I´m dealing with the header and have set up a couple of structs that holds both a set of names and variables such as file size, sample rate etc. At the moment I´m using printf to create the new header and pass the output to a new file that I can inspect in a hexeditor.
Code:
The FORM chunk represents the first 12 bytes in a aiff file.
The problem now is that 'size' shows up as a string in the hexeditor and occupy 4 whole bytes, Eventhough it´s a 2 byte value. Is there a way to get around this using printf?Code:// FORM chunk typedef struct { char *ckID; // 'FORM' int ckDataSize; char *formType; // 'AIFF' } FormAIFFChunk; int size = 0x3E52; // for testing purpose only! * // collect size and print FORM chunk FormAIFFChunk form = {"FORM", 0x0000, "AIFF"}; form.ckDataSize = size; printf("%s%x%s", form.ckID, form.ckDataSize, form.formType);
I did an earlier atempt using arrays and memcpy, but using the structs got a lot more clear.



LinkBack URL
About LinkBacks



