Greg,
here's an example of reading the database and tags file :
#include <fcntl.h>
#include <stdio.h>
#define DBFILE "database"
#define TAGFILE "tags"
int main(int argc, char *argv[])
{
unsigned char c;
char s[2048];
char *tags[20];
int i,end_entry;
FILE *fp;
fp=fopen(TAGFILE, "rb");
i=0;
while (fgets(s,sizeof(s), fp) != NULL) {
s[strlen(s)-1]='\0';
tags[i++]=(char *)strdup(s);
}
fclose(fp);
i=0;
fp=fopen(DBFILE, "rb");
while ( fread(&c,1,1,fp) > 0 ) {
if ( c == 0xFF ) {
end_entry=1;
} else {
if (end_entry) {
printf("--------------------------------\n");
end_entry=0;
}
i=c;
fread(&c,1,1,fp);
fread(s,1,c,fp);
s[c]='\0';
printf("%s : %s\n",tags,s);
}
}
fclose(fp);
}
This program generates a list like this :
--------------------------------
type : illegal
--------------------------------
length : 20
title : All Music
type : playlist
--------------------------------
length : 32
options : 0x0
pickn : 0
pickpercent : 0
title : CD
type : playlist
--------------------------------
ctime : 1028582027
length : 124
title : abc
type : playlist
--------------------------------
ctime : 1028582027
length : 4
title : Aerosmith
type : playlist
--------------------------------
ctime : 1028582027
length : 60
title : Get A Grip
type : playlist
--------------------------------
artist : Aerosmith
bitrate : vs159
codec : mp3
comment : Track 1
ctime : 1028582027
duration : 23563
file_id : 1
genre : Rock
length : 470285
offset : 1631
samplerate : 44100
source : Get A Grip
title : Intro
tracknr : 1
type : tune
year : 1993
--------------------------------
.....
The entries of playlists can be read from the playlists file(obviously). I think they are stored in the same order as found in the database file. Just use the length attrib of playlists to read the right amount of data.