All pastes #220783 Raw Edit

Mine

public text v1 · immutable
#220783 ·published 2006-10-25 10:03 UTC
rendered paste body
int     my_strlen(char *str);
int     my_power_it(int nb, int power);

char    *DecToBase(char *bf, int nb) // Revoie le decimal dans la base indiquee.
{
  char *rest;
  int   to;
  int   i;

  i = 0;
  to = my_strlen(bf);
  *rest = malloc(19);
  while ()
    {
      my_putstr("Valeur de i: ");
      my_put_nbr(i);
      my_putchar('\n');
      my_putstr("Valeur de nb: ");
      my_put_nbr(nb);
      my_putchar('\n');
      my_putstr("Valeur de to: ");
      my_put_nbr(to);
      my_putchar('\n');
      my_putstr("Valeur de nb%to: ");
      my_put_nbr(nb%to);
      my_putchar('\n');
      rest[i] = bf[nb % to];
      nb /= to;
      i++;
    }
  rest[i] = '\0';
  my_putstr("Valeur finale de rest: ");
  my_putstr(rest);
  my_putchar('\n');
  return (rest);
}


int     main()
{
  //  char      *osef;

  //*osef = malloc(19);
  DecToBase("0123456789ABCDEF", 42);
  //  my_putstr(osef);
}