Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - dbltoptr() poke a dbl value into a memory address http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 dbltoptr()          Poke a dbl value into a memory address
------------------------------------------------------------------------------
 Declaration
   memory.hdr

 Syntax
   proc dbltoptr extern
   param const dbl      eValue, ;
         value _POINTER pMem

 Arguments
   eValue is the value to place in memory.
   pMem is the target address.

 Return
   None.

 Description
   This procedure copies a dbl value into the specified memory location.

   The procedure is included for compatibility with earlier Force versions.
   Use the ptr() data type in conjunction with the & and * operators for
   directly writing to explicit memory addresses.

 Example
   #define EXAMPLE_MEMORY
   #include example.hdr

   proc Test_dbltoptr
   vardef
      ptr( dbl ) pMem         // pointer
   enddef
   pMem := malloc( 1000 )     // allocate working space
   
   dbltoptr( 11.1, pMem )     // write a dbl to memory via function call
   ? *pMem                    // prints 11.1
   *pMem := 33.3              // write a dbl to memory via pointer
   ? *pMem                    // prints 33.3
   free( pMem )               // free allocation
   endproc

   proc main
   Test_dbltoptr()
   endproc

See Also: dbltosegoff()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson