// Wave Header Info. // Bahram Shoja Ardalan // CeNTiPeDe // 76/12/25 #include #include #include #define byte unsigned char #define word unsigned int void main (int , char *p[]) { FILE *file; byte id[5]; unsigned long size; byte id2[9]; byte bits; word freq; word freq2; byte id3[5]; unsigned long size2; word u; file = fopen (p[1],"rb"); textcolor(15); clrscr(); // 0: 4 bytes ID fseek(file,0,0); fread(id,4,1,file); id[4] = 0; cprintf("ID : %s\n\r",id); // 4: 4 bytes SIZE fseek(file,4,0); size = fgetc(file) * 0x1 + fgetc(file) * 0x100 + fgetc(file) * 0x10000 + fgetc(file) * 0x1000000; cprintf("Size : %lu bytes\n\r",size); // 8: 8 bytes ID2 fseek(file,8,0); fread(id2,8,1,file); id2[8] = 0; cprintf("ID2 : %s\n\r",id2); // 16: UNKNOWN fseek(file,16,0); u = fgetc(file) * 0x1 + fgetc(file) * 0x100; cprintf("16 : %u\n\r",u); // 18: UNKNOWN fseek(file,18,0); u = fgetc(file) * 0x1 + fgetc(file) * 0x100; cprintf("18 : %u\n\r",u); // 20: UNKNOWN fseek(file,20,0); u = fgetc(file) * 0x1 + fgetc(file) * 0x100; cprintf("20 : %u\n\r",u); // 22: UNKNOWN fseek(file,22,0); u = fgetc(file) * 0x1 + fgetc(file) * 0x100; cprintf("22 : %u\n\r",u); // 24: 2 bytes Sampling Rate fseek(file,24,0); freq = fgetc(file) * 0x1 + fgetc(file) * 0x100; cprintf("Freq : %u\n\r",freq); // 26: UNKNOWN fseek(file,26,0); u = fgetc(file) * 0x1 + fgetc(file) * 0x100; cprintf("26 : %u\n\r",u); // 28: 2 bytes Sampling Rate 2 (?) fseek(file,28,0); freq2 = fgetc(file) * 0x1 + fgetc(file) * 0x100; cprintf("Freq2 : %u\n\r",freq2); // 30: UNKNOWN fseek(file,30,0); u = fgetc(file) * 0x1 + fgetc(file) * 0x100; cprintf("30 : %u\n\r",u); // 32: UNKNOWN fseek(file,32,0); u = fgetc(file) * 0x1 + fgetc(file) * 0x100; cprintf("32 : %u\n\r",u); // 34: 2 bytes Number of Bits fseek(file,34,0); bits = fgetc(file) * 0x1 + fgetc(file) * 0x100; cprintf("Bits : %u\n\r",bits); // 36: 4 bytes ID3 (DATA) fseek(file,36,0); fread(id,4,1,file); id3[4] = 0; cprintf("ID3 : %s\n\r",id); // 40: 4 bytes SIZE 2 (?) fseek(file,40,0); size2 = fgetc(file) * 0x1 + fgetc(file) * 0x100 + fgetc(file) * 0x10000 + fgetc(file) * 0x1000000; cprintf("Size2 : %lu bytes\n\r",size2); fclose(file); getch(); }