` Printed Icetips Article

Icetips Article



Clarion in general: Memcpy to get a value from an address
2004-03-11 -- Paul Attryde
 
Newsgroups: softvelocity.clarion.language


> I am calling a function that returns that address of a memory location.
> How do I get the contents of that location when all I have is the address?

So you're doing something (making an API call for example) and getting
back a pointer? But because CW doesn't support pointers you can't
dereference it?

There's a couple of ways to do it.

You can do what Bernie suggested and use a reference variable (but that
assumes you're using a version of CW that supports reference variables,
and this is softvelocity.clarion.language, not softvelocity.public.clarion6)

Personally I use memcpy, only because I've been doing this for a while
and CW2 didn't have reference variables :)
http://www.attryde.com/clarion/cw_prototypes.htm, #8

ISTR Randy Goodhew saying you can do it using PEEK as well, but I've
never used that.  You may have to search the NGs for more info.

--
Paul



Printed November 21, 2024, 6:54 am
This article has been viewed/printed 35222 times.
Google search has resulted in 116 hits on this article since January 25, 2004.