Edit Anything

Professional text and hex editing
with Binary Templates technology.






SweetScape Knowledgebase
KB1023: How do convert an enum value to a string?

The special EnumToString function can be used to convert an enum to a string. This function works in two different ways: it can be used to convert an enum value to a string (in the example below FIRST is converted to "FIRST"), or it can also be used to convert an enum variable to a string (in the example below myenum is converted to "SECOND").

    enum MYENUM { FIRST, SECOND };
    local MYENUM myenum = SECOND;
     
    Printf( "FIRST ='%s'\n", EnumToString( FIRST ) );
    Printf( "myenum='%s'\n", EnumToString( myenum ) );

The above code prints out the following results:

    FIRST ='FIRST'
    myenum='SECOND'

This function is especially useful in custom read functions which need to return a string value.



Back to knowledgebase index
Back to main support page



Our Products


Latest News


Download
- 010 Editor
v8.0
is now available.

Download it now!
What's New in 8.0?


Newsletter
Join our newsletter to receive tips and tricks on hex editing, special offers, and news from SweetScape Software Inc.

Sign-up Now...