String to tchar / getStringAttribute((String)attribname)how?

hi,
i try to get an XML attribute with a variable attribute name.
like this:

void SomeClass::fillList(ComboBox* box,String fieldName)
{
box->addItem(someXmlData->getStringAttribute(fieldName));
}

getStringAttribute wants “const tchar *const attributeName” of course, but how to convert to this from String? i don’t get it.

thanks

D3CK

The easiest ways is just to wrap the String in a T() macro,

I.E. instead of “hello” use T(“hello”)

thanks
but using literals does not help here.
:wink:
D3CK

Well, a string will readily produce a Tchar type. Is it just a cast to const you need?

Bruce

ahh! I’m a bit shy with type casts when not using my own classes.
so:

String cat;
String text = someXmlData->getStringAttribute((const tchar*)cat);

seems to work so far.
thanks a lot!
:smiley:
D3CK

There’s no need to explicitly use that (const tchar*) cast there, the compiler will handle it for you.