第一个是,提取 DOS 版仙剑 MIDI 音乐的,原来骗过稿费的东西
代码 |
#include <stdio.h> #include <stdlib.h> #include <conio.h> char TargetFileName[32]="PAL_00.mid"; void main(void) { FILE *SourceFile,*TargetFile; long Start,End,Len; int i,j,k,file; file=0; clrscr(); gotoxy (18,10); printf ("PAL Music Maker, Made by Ashuro. Date:2000/12/21\n"); if ((SourceFile=fopen ("MIDI.MKF"),"rb")=NULL) { gotoxy (21,13); printf ("Can not find MIDI.MKF\n"); exit(1); } for (i=1;i<87;i++) { fseek (SourceFile,1*4,SEEK_SET); fread (&Start,1,4,SourceFile); fread (&End,1,4,SourceFile); fseek (SourceFile,Start,SEEK_SET); Len=End-Start; if (len>0) { ++file; TargetFileName[6]=(file/10)+'0'; TargetFileName[7]=(file%10)+'0'; TargetFile=fopen (TargetFileName,"wb"); gotoxy (23,13); printf ("Now Saving %d music: %s",file,TargetFileName); for (j=0;j<len;j++) { k=fgetc (SourceFile); fputc (k,TargetFile); } fclose (TargetFile); } } fclose (SourceFile); gotoxy (29,15); printf ("Music has all saved successfully.\n"); }
|