/***************************************************************************
                          itoa.c  -  description
                             -------------------
    begin                : vie ago 23 2002
    copyright            : (C) 2002 by deabru
    email                : deabru@nubbis.com
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

void itoa (int integer,char string[],int base)
{
/* convert integer to string in base base */

    char auxS[256];
/*    int result = 0;*/
 /*  int auxI1,auxI2;*/
    int div,i=0,j=0;

    div = integer;

    do
    {
			auxS[i] = div % base + '0';
			div = div / base;
			i++;
    }
    while (div > 0);
    auxS[i]='\0';

    for(j=0;j<i;j++)
    {
			string[j] = auxS[i-j-1];
    }
    string[j]='\0';

    return;
}