how to make dec to bin?

is there any function who makes deciaml numbers 2 hexodecimal?
Lots of ways to do it.

stringstream s;
s << hex << 3213;
cout << s.str();
Use "sprintf" with format "x" or "X".
For more info check this http://www.cplusplus.com/reference/clibrary/cstdio/sprintf.html


In Windows better use "sprint_f" - no warnings

#ifdef __WIN32__
sprintf_s(...);
#endif

#ifdef __MACOSX__
sprintf(...);
#endif
/***********************************************************/


For checking OS you can use

#if defined(WIN32) || defined(_WIN32) || defined(WIN32_LEAN_AND_MEAN)
/* windows system */
#define __WIN32__
#else
/* not windows system */
#if defined(MACOS_X) || defined(__APPLE__)
#define __MACOSX__
#endif
#endif
Topic archived. No new replies allowed.