一个显示MP3文件信息的程序

/*
一个显示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:%s\n”, x.Title);
printf(“Artist:%s\n”, x.Artist);
printf(“Album:%s\n”, x.Album);
printf(“Year:%s\n”, x.Year);
printf(“Comment:%s\n”, x.Comment);
printf(“Genre:%d\n”, x.Genre);
return 0;
}

历史上的今天

If you like this post and would like to receive updates from this blog, please subscribe our feed. Subscribe via RSS

Leave a Reply