Author Topic: Problems with StreamGetTags  (Read 5646 times)

zajkos

  • Posts: 17
Problems with StreamGetTags
« on: 25 Jul '03 - 09:29 »
I want to get the tag. I wrote this:
Code: [Select]

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)
« Last Edit: 25 Jul '03 - 09:29 by zajkos »

Ian @ un4seen

  • Administrator
  • Posts: 26079
Re: Problems with StreamGetTags
« Reply #1 on: 25 Jul '03 - 13:39 »
Follow the link in the BASS_StreamGetTags docs for details on the ID3v1 tag structure... that's what you receive from BASS :)

zajkos

  • Posts: 17
Re: Problems with StreamGetTags
« Reply #2 on: 29 Jul '03 - 13:48 »
I know, but I don't get any valid strings, only bushes

biggyspender

  • Posts: 28
Re: Problems with StreamGetTags
« Reply #3 on: 29 Jul '03 - 14:04 »
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

  • Posts: 17
Re: Problems with StreamGetTags
« Reply #4 on: 31 Jul '03 - 07:24 »
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.