an action in my contract accepts an asset:

void token::burn(asset a)

which I want to print out:

printf("Asset [%s] burnt\n", a.symbol.to_string());

except the symbol class does not offer stringification. there's a print method but that's not what I need as I want a string I can embed elsewhere

this seems like pretty basic functionality. how is this done?

1 Answer 1


the answer turns out to be:

printf("Asset [%s] burnt\n", a.symbol.code().to_string().c_str());

thanks to @aarin_hagerty on https://t.me/joinchat/Esi1OkPktgcFeJ3Lmlcrqg for the answer

  • Thank you for posting the answer here, even though you got the answer elsewhere! Commented Mar 4, 2019 at 5:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.