导读 #include #include #include int main(int argc,char **argv){ if (argc != 2) { printf("Need a file!"); return 0;...
#include #include #include int main(int argc,char **argv){ if (argc != 2) { printf("Need a file!"); return 0; } else { FILE *in; in=fopen(argv[1],"r"); if ( ! in ) return 0; fseek(in,-128,SEEK_END); char *str; char s[3]; fread(&s,1,3,in); if ( memcmp(&s,"TAG",3) ) { printf("Do not contain ID3V1 TAG"); return 0; } else { printf("ID3v1 info"); str=malloc(30*sizeof(char)); int i; fread(str,1,30,in); printf(" TITLE: %s",str); fread(str,1,30,in); printf(" ARTIST: %s",str); fread(str,1,30,in); printf(" ALBUM: %s",str); fread(str,1,4,in); if ( str[0] != 0 ) printf(" YEAR: %c%c%c%c",str[0],str[1],str[2],str[3]); else printf(" YEAR:"); fread(str,1,30,in); printf("COMMENT: %s",str); if ( (str[28]==0) && (str[29]>0) ) printf(" TRACK: %d",str[29]); else printf(" TRACK:"); fread(str,1,1,in); if ( (unsigned char)str[0] != 0xFF ) printf(" GENRE: %u",(unsigned char)str[0]); else printf(" GENRE:"); free(str); } close(in); }}。
免责声明:本文由用户上传,如有侵权请联系删除!