1 // WAV file header reader
2 // (Last build: 7/21/1998)
6 // (c) 1998 Underground Software
22 #define BYTE unsigned char
23 #define WORD unsigned short int
24 #define DWORD unsigned long int
29 int main(int argc, char * argv[])
31 fstream ff; // Declare fstream without file hooks...
35 strcpy(file, ".\\sounds\\");
39 strcat(file, argv[1]);
43 strcat(file, "fm12.wav");
45 ff.open(file, ios::binary | ios::in);
48 for(int i=0; i<4; i++) { ff.get(ch); cout << ch; }
53 ff.get(ch); len = (int)ch;
54 ff.get(ch); len |= (int)ch << 8;
55 ff.get(ch); len |= (int)ch << 16;
56 ff.get(ch); len |= (int)ch << 24;
58 cout << "Length of header chunk: [" << hex << len << "]" << endl;
61 for(int i=0; i<8; i++) { ff.get(ch); cout << ch; }
64 ff.get(ch); len = (int)ch;
65 ff.get(ch); len |= (int)ch << 8;
66 ff.get(ch); len |= (int)ch << 16;
67 ff.get(ch); len |= (int)ch << 24;
69 cout << "Length of header2 chunk: [" << hex << len << "]" << endl;
71 for(int i=0; i<(signed)len; i++)
73 ff.get(ch); cout << hex << (int)ch << " ";
78 for(int i=0; i<4; i++) { ff.get(ch); cout << ch; }
81 ff.get(ch); len = (int)ch;
82 ff.get(ch); len |= (int)ch << 8;
83 ff.get(ch); len |= (int)ch << 16;
84 ff.get(ch); len |= (int)ch << 24;
86 cout << "Length of header3 chunk: [" << hex << len << "]" << endl;
88 for(int i=0; i<(signed)len; i++)
90 ff.get(ch); cout << hex << (int)ch << " ";
94 for(int i=0; i<120; i++)
96 ff.get(ch); cout << hex << (int)ch << " ";
100 ff.close(); // Close tracelog