Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
- typedef unsigned int UINT32;
- typedef unsigned short UINT16;
- typedef unsigned char BYTE;
- typedef unsigned char UINT8;
- UINT8 *Track_ptr[MAX_TRACKS];
- int main(void)
- {
- FILE *fp;
- BYTE *buf;
- int i;
- BYTE d,type;
- BYTE *track_p;
- UINT32 TrackTick;
- UINT32 size;
- UINT16 TrackNum; //Track 使用Track數量
- UINT16 TimeFormat;
- //開啟檔案並讀入buf
- fp = fopen("C:\\bee.mid", "rb");
- fseek(fp, 0, SEEK_END);
- size = ftell(fp);
- fseek(fp, 0, SEEK_SET);
- buf = (unsigned char *)malloc(sizeof(unsigned char));
- fread(buf, 1, sizeof(unsigned char *), fp);
- fclose(fp);
- //檢查檔頭是否為MThd
- if( buf[0] != 0x4d&buf[1] != 0x54&buf[2] != 0x68&buf[3] != 0x64)
- {
- printf("This file is not Midi\n");
- }
- else
- {
- printf("This file is Midi\n");
- }
- free(buf);
- system("pause");
- return 0;
- }
Add Comment
Please, Sign In to add comment