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).

Back to knowledgebase index
Back to main support page

Our Products

Latest News

- 010 Editor
is now available.

Download it now!
What's New in 8.0?

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

Sign-up Now...