The code i have is this.It work only with dec values.
or is MOS strtolong enhanced that strtolong support too hex values ?
BOOL LoadCodePage(const char *filename)
{
BOOL ret = FALSE;
BPTR file;
UBYTE buf[256];
SetDefaultCodePage();
file = Open(filename, MODE_OLDFILE);
if (file)
{
ret = TRUE;
while (FGets(file, buf, sizeof(buf)))
{
STRPTR p = buf;
LONG index, unicode;
LONG chars;
if (*p == '#')
continue;
chars = StrToLong(p, &index);
if (chars <= 0 || index < 0 || index > 255)
continue;
p += chars;
chars = StrToLong(p, &unicode);
kprintf ("%d %d\n",codepage[index],unicode);
if (chars <= 0)
continue;
codepage[index] = (UWORD)unicode;
}
Close(file);
}
return ret;
}
here is code of aros strtolong
{
AROS_LIBFUNC_INIT
AROS_LIBBASE_EXT_DECL(struct DosLibrary *,DOSBase)
LONG sign=0, v=0;
CONST_STRPTR s=string;
/* Skip leading whitespace characters */
if(*s==' '||*s=='\t')
s++;
/* Swallow sign */
if(*s=='+'||*s=='-')
sign=*s++;
/* If there is no number return an error. */
if(*s<'0'||*s>'9')
{
*value=0;
return -1;
}
/* Calculate result */
do
v=v*10+*s++-'0';
while(*s>='0'&&*s<='9');
/* Negative? */
if(sign=='-')
v=-v;
/* All done. */
*value=v;
return s-string;
AROS_LIBFUNC_EXIT
} /* StrToLong */