Reading int16

Discuss OrbForms Designer and PocketC Architect

Postby johncraw on Fri Oct 14, 2005 4:26 pm

I am trying to reverse engineer a prc. In loomking at it the integers are 16 not 32 bit. Is there a standard/accepted/correct way to read these values?
So far the best I can do is read the two bytes as char, multiply the first by 256, and add the second one. This works, but I also need to handle if the char integer value is negative.
Any direction would be appreciated.
Thanks in advance
John Crawford
johncraw
 
Posts: 64
Joined: Mon May 24, 2004 11:39 am
Location: Canada

Postby dewey on Sat Oct 15, 2005 2:23 pm

When you specify the type string for reading, use "w" instead of "i". To do this, you will need to specify a type string directly, rather than using the typeof() expression. See "Type Strings" in the docs for more details.
dewey
Site Admin
 
Posts: 749
Joined: Sun Oct 21, 2007 5:12 am

Postby johncraw on Tue Oct 18, 2005 9:37 am

Thanks.
John
johncraw
 
Posts: 64
Joined: Mon May 24, 2004 11:39 am
Location: Canada


Return to OrbForms Designer and PocketC Architect

Who is online

Users browsing this forum: No registered users and 3 guests

cron