Programming - cpueblo.com

ID3TAG 얻어오는 코드


글쓴이 : 유광희 날짜 : 2002-07-15 (월) 16:45 조회 : 5837
int GetID3Tag(char *FileName) { int handle; int i; handle = _lopen(FileName, _O_RDONLY); _llseek(handle, -128, FILE_END); _lread(handle, &ID3Ver1, sizeof(ID3TAG)); _lclose(handle); if (ID3Ver1.Tag[0] == 'T' && ID3Ver1.Tag[1] == 'A' && ID3Ver1.Tag[2] == 'G') { // Song, Title 이 SPACE 문자로 채워지게 된다. 고로 뒤에서부터 SPACE 를 NULL 로 채운다 for (i = 30 - 1; i > 0; i--) { if (ID3Ver1.Song[i] == ' ') ID3Ver1.Song[i] = NULL; else break; } for (i = 30 - 1; i > 0; i--) { if (ID3Ver1.Artist[i] == ' ') ID3Ver1.Artist[i] = NULL; else break; } return 1; } else // ID3 TAG 1.0 이 아니다 return 0; } typedef struct sID3TAG { char Tag[3]; char Song[30]; char Artist[30]; char Album[30]; char Year[4]; char Comment[30]; char Genre[1]; } ID3TAG; 예전에 cix.co.kr 에서 WinAmp Plugin 에 들어간 소스 입니다~