1

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

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

|improve this answer|||||
  • Thank you for posting the answer here, even though you got the answer elsewhere! – Phillip Hamnett - EOS42 Mar 4 '19 at 5:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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