Menu

#72 id3lib.dll and borland 5 runtime error

open
nobody
None
5
2004-11-25
2004-11-25
Anonymous
No

I'm having a wierd problem using id3lib.dll with
borland c++ 5.
I have created an id3lib.def file, manually edited it
and then used that to create id3lib.lib. This allows
me to use the precompiled windows binary. my problem
is when calling ID3Tag_FindFrame. This call seems to
overwrite memory and cause various errors. In my
snippet below, I have defined a char array of 36 bytes
which solves the problem.

Any ideas on what the problem may be ?

Thank You

John@tolltex.com

#pragma link "id3lib.lib";
#include "id3.h"
void __fastcall TForm1::Button2Click(TObject *Sender)
{
ID3Tag *myTag = NULL;
ID3Frame *myFrame = NULL;
ID3Field *myField = NULL;
char it_works_with_this_array_uncommented[36];
char *buffer = NULL;

// get the pathname from the form
buffer = (char *) malloc(1024);
memset(buffer, 0, 1024);
sprintf(buffer, Edit2->Text.c_str());

// get the tag
myTag = ID3Tag_New();
ID3Tag_Link(myTag, buffer );

// get the title
myFrame = ID3Tag_FindFrameWithID(myTag,ID3FID_TITLE);
myField = ID3Frame_GetField(myFrame,ID3FN_TEXT);
ID3Field_GetASCII(myField,buffer,1024);

// display results
Edit3->Text = buffer;

// clean up
ID3Tag_Delete(myTag);
free(buffer);

return;
}

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.