Problems with StreamGetTags

Started by zajkos, 25 Jul '03 - 09:29

zajkos

I want to get the tag. I wrote this:
HSTREAM song=Bass_StreamCreateFile(0,File.c_str(),0,0,0);
if (song==NULL) ShowMessage("ERROR STREAM CREATE FILE");

char *t=Bass_StreamGetTags(song,BASS_TAG_ID3);
if (t==NULL) {ShowMessage("ERROR STREAM GET TAGS");}
int lenght=strlen(t);
ShowMessage(t);

and it doesn't work. ShowMessage(t) generates application exception or shows some bushes (eg. "& @$ dsa").
Lenght is 12, 14 or 17 (it should be 128 ).
What did I do wrong? The ID# tag are OK, because Winamp shows them correctly (of course it's ID3 v.1)

Ian @ un4seen

Follow the link in the BASS_StreamGetTags docs for details on the ID3v1 tag structure... that's what you receive from BASS :)

zajkos

I know, but I don't get any valid strings, only bushes

biggyspender

I think you're confused ??? because the return type is char*. This merely indicates a pointer to a byte array (a char is an 8-bit/1-byte type) :idea:, not a null terminated string :(. The help file points you in the right direction for extracting valid information from this array :D :D :D.

zajkos

ok, I know what was wrong. In the code above I didn't write it because I thougth I was not important, but I used Bass_StreamFree() function before
ShowMessage(t);
I moved it past reading from t and now it works.