Help me help him help me
February 12, 2007 8:58 AM   RSS feed for this thread Subscribe

Help me help my friend help me. He's working on a database project using MusicBrainz (the one here) and has run into a programming issue--he's unable to retrieve tracks. He's using C++ and XML. Details are inside.

Here is his question:
=========
i guess the question would be partially concerning this block of code:

for (ReleaseList::iterator i = releases.begin(); i != releases.end(); i++) {
Release *release = *i;
ReleaseEventList relList = release->getReleaseEvents();
tList = release->getTracks();
cout < endl; cout id : release->getId() < endl; cout title : release->getTitle() < endl; cout year : release->getReleaseEvent(0)->getDate().substr(0,3) < endl; cout tracks : release->getTrack(0)->getTitle() < endl; cout tracks follow --- endl; for (j=0; j =release->getNumTracks() - 1; j++) {
cout < track j release->getTrack(j) < endl; } } which seems to segfault (crash) at the strong>release->getReleaseEvent(0)->getDate().substr(0,3) < endl;/strong> line.

The getReleaseEvent() seems to be causing the problem, more than anything.

Then when I try to get tracks...

cout < tracks : release->getTrack(0)->getTitle() < endl;/strong> also seems to crap out.

Finally,

for (j = 0; j < release->getNumTracks() - 1; j++) {
cout < track j release->getTrack(j) < endl; }/strong>

just doesn't work, because getNumTracks() ALWAYS returns 0.
=========
Thank you very much!
posted by schroedinger to computers & internet (3 comments total)
Ow. I'd like to help you, but the formatting there is hurting my brain. Is it possible that you could post the source somewhere with it's formatting intact, and the problem either as comments in the code, or a separate document?

In addition to the formatting, I can't really see enough of the implementation to get much of an idea of what's going on, so seeing some more source would help with that as well.
posted by benign at 9:35 AM on February 12, 2007


yeah, use something like dpaste to paste the code so we can see it a bit more legibly.

If the getReleaseEvent() call seems to be causing the problem, then it would be nice to know what that function does, it's requirements, etc. I'd guess that you're referring to this function but i'm not sure. I'd also want to see the code that created your ReleaseList in the first place.
posted by escher at 10:28 AM on February 12, 2007


Sweet Christmas, that came out a lot uglier on posting. And the strong tags are all messed up. Jesus. Sorry! Here is the dpaste link (thanks for the tip).
posted by schroedinger at 11:14 AM on February 12, 2007


« Older Electronics filter: When I co...   |   What do you like most and leas... Newer »

You are not logged in, either login or create an account to post comments



Related Questions
hello, world (of programming) August 17, 2008
I need skillz February 18, 2008
Where to begin with Ruby on Rails? December 29, 2007
I have some savings and would like to become a... May 20, 2007
What books should be on my "personal CS degree"... November 6, 2006