1. 64-bit numbers

I don't know what why is this not working.

I get this:
valseq = {129,238,123,1,0,0,0,0}
val = 0.000000

Code:

atom ptr, val
sequence valseq

--Allocate
ptr = allocate (8)

-- Here I send message to C program which will
-- write into ptr.
....

-- Read what C program has written into our buffer:
valseq = peek ({ptr, 8})
val = float64_to_atom (valseq)



// C code which writes into
// buffer which was allocated in Euphoria program.
LONGLONG llPlayback; //64-bit value
int address_data_size = 8;
llPlayback = 24899201;
WriteProcessMemory(
          hCallerProcess,
         (LPVOID) address,
          &llPlayback,
          address_data_size,
          &bytesWritten);


Maybe I should divide 64-bit number into two 32-bit numbers. How would I do
that? In Euphoria or C.

new topic     » topic index » view message » categorize

2. Re: 64-bit numbers

>From: tone.skoda at gmx.net
>Subject: 64-bit numbers
>
>
>I don't know what why is this not working.
>
>I get this:
>valseq = {129,238,123,1,0,0,0,0}
>val = 0.000000
>
>Code:
>
>atom ptr, val
>sequence valseq
>
>--Allocate
>ptr = allocate (8)
>
>-- Here I send message to C program which will
>-- write into ptr.
>....
>
>-- Read what C program has written into our buffer:
>valseq = peek ({ptr, 8})
>val = float64_to_atom (valseq)
>

It's not a double.....

>
>// C code which writes into
>// buffer which was allocated in Euphoria program.
>LONGLONG llPlayback; //64-bit value
>int address_data_size = 8;
>llPlayback = 24899201;
>WriteProcessMemory(
>           hCallerProcess,
>          (LPVOID) address,
>           &llPlayback,
>           address_data_size,
>           &bytesWritten);
>
>
>Maybe I should divide 64-bit number into two 32-bit numbers. How would I do
>that? In Euphoria or C.

  Try just two peek4's and put it in a sequence... Supposedly atoms can hold 
64-bit integer numbers, but you may want to ask Robert Craig first.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu