Re: Poking and peeking C_USHORT

new topic     » goto parent     » topic index » view thread      » older message » newer message

Try this 

--(for intel machines)...

atom addr -- Pointer to memory
atom  val

-- peeking
  val = 256 *peek(addr) + peek(addr+1)
--poking
  poke(addr, {floor(val / 256), and_bits(val, 256)})

--(for non-intel machines)...
-- peeking
  val = 256 *peek(addr+1) + peek(addr)
--poking
  poke(addr, {and_bits(val, 256),floor(val / 256) })

  
----- Original Message ----- 
From: "Jonas Temple" <jktemple at yhti.net>
To: "EUforum" <EUforum at topica.com>
Sent: Saturday, October 13, 2001 1:24 PM
Subject: Poking and peeking C_USHORT


> 
> Okay...here's the question....
> 
> When a dll function calls for a pointer to an short (signed or unsigned) 
> what is the preferred method of poking and peeking the data? I am 
> working on wrapping several dlls and it calls for short data type.
> 
> I used peek() and then bytes_to_int() but bytes_to_int expects a 
> sequence with a length of 4.  Since the data is only two bytes, what is 
> the easiest way to translate back to an atom?
> 
> Any help would be greatly appreciated.
> 
> Jonas
> 
> 
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu