findAndGetOFStringArray - the string is not cleared

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
Alexander Fedotov
Posts: 53
Joined: Thu, 2005-04-14, 15:07
Location: St. Petersburg, Russia

findAndGetOFStringArray - the string is not cleared

#1 Post by Alexander Fedotov »

Hi!
Here is the piece of code:

***************
DcmDataset *pDataset = m_pDcmFileFormat->getDataset();
OFString strTagValue;

pDataset->findAndGetOFStringArray(TagKey1, strTagValue);
cout << strTagValue.c_str(); // the value is correct, for example "bla-bla-bla"

pDataset->findAndGetOFStringArray(TagKey2, strTagValue);
// returns "good", but the attribute value is not set, it has a zero length
cout << strTagValue.c_str();// the value remains the same, "bla-bla-bla"
***********************

So one has to add strTagValue.clear() before the second call
of findAndGetOFStringArray();

If it is "as designed", I think it has to be documented somewhere, because it may cause "bugs" in the application.

Or I missed something?

Best Regards,
Alexander.

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#2 Post by Jörg Riesmeier »

Thank you for the report. There seems to be a bug in DcmElement::getOFStringArray(). We'll fix this for the next release.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest