/*
一个显示MP3文件信息的程序
2004.01.01 第一版
Copyright (C) 2004, bluetent
*/
include
include
include
include
struct TID3Tag{
char TAGID[3]; // 3 字节: 必须是TAG
char Title[30]; // 30 字节: 歌曲标题
char Artist[30]; // 30 字节: 歌曲的艺术家
char Album[30]; // 30 字节: 歌曲专辑
char Year[4]; // 4 字节: 出版年
char Comment[30]; // 30 字节: 评论
char Genre; // 1 字节: 种类标识
}x;
int main(int argc, char* argv[])
{
FILE *fp;
int fd;
if(argc<2){
printf(“Usage: mp3detail n”);
return -1;
}
fd=open(argv[1], O_RDONLY);
lseek(fd, 0L, SEEK_END);
lseek(fd, -128L, SEEK_CUR);
read(fd, &x, 128);
close(fd);
printf(“Title:%sn”, x.Title);
printf(“Artist:%sn”, x.Artist);
printf(“Album:%sn”, x.Album);
printf(“Year:%sn”, x.Year);
printf(“Comment:%sn”, x.Comment);
printf(“Genre:%dn”, x.Genre);
return 0;
}