On Thu, 2002-10-03 at 14:18, William Chow wrote:
> You do the same thing as you did for the byte , you cast it as an unsigned
> short.
> So just replace 8 with 16. Read up on casting in K&R and the C FAQ (found
> online). Should be pretty obvious.

And your program will segfault 50% of the time, depending on the length
of the string that precedes the two-byte integer. The best way to get a
UInt16 back from a location that is not necessarily aligned on an even
boundary is

  UInt16 dest;
  Char* source
  MemMove(&dest, source, sizeof(dest));

-- 
Dave Carrigan
Seattle, WA, USA
[EMAIL PROTECTED] | http://www.rudedog.org/ | ICQ:161669680
UNIX-Apache-Perl-Linux-Firewalls-LDAP-C-C++-DNS-PalmOS-PostgreSQL-MySQL

Dave is currently listening to Blues Traveler - Ivory Tusk (Travelers &
Thieves)


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to