Edit Anything

Professional text and hex editing
with Binary Templates technology.

SweetScape Knowledgebase

KB1016: How do I convert an int to a string?

The easiest way to convert an integer (short, int, int64, etc.) to a string is to use the SPrintf function. For example:

     ushort a = 16;
     string s;
     SPrintf( s, "%d", (int)a );

After this code is executed, the variable 's' will contain the string '16'. Remember when using the SPrintf function that the arguments passed to the function must match the format string (e.g. when using '%d' you must pass an int, not a short).

Newsletter - Receive special offers, tips, tricks and news. Join now

010 Editor v14.0.1 is here!
What's new?



010 Editor

E-mail: info@sweetscape.com