Author Topic: Toolchain based on Flatmush's question...  (Read 2136 times)

madcat1990

  • Guest
Toolchain based on Flatmush's question...
« on: December 21, 2009, 11:57:23 pm »
Hey, I've been using a toolchain based on flatmush's to start programming on the dingoo...

got it here : http://www.dingoo-digital.com/forums/developers-corner/new-sdk

though... it doesn't have String to hex conversion, because whenever I try to integrate stdio.h it can't compile, any help on this? D:

alekmaul

  • Posts: 330
    • Portabledev
Re: Toolchain based on Flatmush's question...
« Reply #1 on: December 22, 2009, 07:31:34 am »
Yes, lots of functions are not yet implement, but a little searchwith google can help you.

You can add in lib/stdlib/string.c such code for string to hex convertion :
Quote
unsigned long StrToHex(char* str)
{
 unsigned long hex,val;
 int n;

 hex=0;
 for(n=0;n<strlen(str);n++) {
  if(str[n]>='0' && str[n]<='9')
   val=(unsigned long)(str[n]-'0');
  else if(str[n]>='a' && str[n]<='f')
   val=((unsigned long)(str[n]-'a'))+0xA;
  else if(str[n]>='A' && str[n]<='F')
   val=((unsigned long)(str[n]-'A'))+0xA;
  else
   val=0;
  hex<<=4;
  hex|=val;
 }
 return hex;
}

madcat1990

  • Guest
Re: Toolchain based on Flatmush's question...
« Reply #2 on: December 22, 2009, 11:16:31 pm »
I love you =3

btw, no stdlib folder on this toolchain ;D

oh another question

can you alter that function to convert a character to hex?

say...

temp[0]=tohex(filedata[0]);
« Last Edit: December 23, 2009, 12:21:30 am by madcat1990 »