Jump to content


Photo

Int To String: Decimal, Hexadecimal, Octal, Binary


  • Please log in to reply
No replies to this topic

#1 Robot Freak

Robot Freak

    GMC Member

  • New Member
  • 271 posts

Posted 28 April 2007 - 08:19 PM

This DLL converts an integer (real values are rounded) to a decimal, hexadecimal, octal or binary string.

Get it HERE.

Source code:
#include "dll.h"
#include <windows.h>

char* output=new char[1024];
int integer_value;

export char* int_to_string_decimal(double value)
{
  integer_value=(int)value;
  itoa(integer_value,output,10);
  return output;
}

export char* int_to_string_hexadecimal(double value)
{
  integer_value=(int)value;
  itoa(integer_value,output,16);
  return output;
}

export char* int_to_string_octal(double value)
{
  integer_value=(int)value;
  itoa(integer_value,output,8);
  return output;
}

export char* int_to_string_binary(double value)
{
  integer_value=(int)value;
  itoa(integer_value,output,2);
  return output;
}

Edited by Murfy_the_game, 22 June 2007 - 06:37 AM.

  • 0