[comp.sys.amiga.programmer] amiga data types

terminal@guru.pub.uu.oz.au (bernard) (06/08/91)

Hi there.. 
Just wondering if anyone could help me with the amiga data types as 
defined in exec/types.h..

Common problems I am having are scanning a UBYTE[] into UWORD 
components.. like this

UBYTE dest[21];

strcpy (dest, "366/359.3");

sscanf(dest, "%d/%d.%d", &net, &node, &point);

where net, node and point are UWORD net, node, point;

when i 
printf("%d/%d.%d\n", net, node, point);
i get something like
359/3.0

???? Any ideas?! Im really stuck, i have tried all sorts of casting and 
could get nothing to work except when 
int net, node, point;
it worked right..

thanks in advance.

bernard

------------
->  Perls of Wisdom from terminal@guru.pub.uu.oz.au (bernard)
->  User Level: 2 (Llama) 
->  The Guru Meditation BBS  -  (03) 375 3438 (all speeds to 9600)

ken@cbmvax.commodore.com (Ken Farinsky - CATS) (06/10/91)

In article <68P831w164w@guru.pub.uu.oz.au> terminal@guru.pub.uu.oz.au (bernard) writes:
>Hi there.. 
>Just wondering if anyone could help me with the amiga data types as 
>defined in exec/types.h..
>
>Common problems I am having are scanning a UBYTE[] into UWORD 
>components.. like this
>
>UBYTE dest[21];
>strcpy (dest, "366/359.3");
>sscanf(dest, "%d/%d.%d", &net, &node, &point);
>where net, node and point are UWORD net, node, point;

Are you using long integers (i.e. int = 32 bits)?  If so, try:

	sscanf(dest, "%ld/%ld.%ld", &net, &node, &point);
-- 
Ken Farinsky - CATS - Commodore Business Machines