ByteVector::Data nulls out?

Scott Wheeler wheeler at kde.org
Thu Apr 20 22:26:22 CEST 2006


On Saturday 08 April 2006 7:19, Nicholas Melnick wrote:
> Hi, there, everyone.
>
> I'm attempting to access TagLib functions via the C API.  I've
> started to add a few functions to be able to access the ID3v2 data,
> and I'm currently working on grabbing artwork.  I've pulled out the
> AttachedPictureFrame, and tried sending it out as a char* via the data
> () function in ByteVector. When I return from the function, I end up
> getting a C string of about 4-8 bytes and nothing else.

Could you paste in the code that you're using?  Or what specifically those 4-8 
bytes are?  I suspect it's either the wrong byte vector being used or that 
you're returning a pointer to a temporary value -- i.e.:

cont char *foo()
{
  ByteVector f("foo");
  return f.data();
}

The above won't work because when f goes out of scope it takes its allocated 
memory with it.  :-)

-Scott

-- 
If you want to get laid, go to college, but if you want an education, go to 
the library.
--Frank Zappa


More information about the taglib-devel mailing list