Re: [GEN]: peek and multiple indirection
Cense wrote...
> i seem to have a problem with pointers and `peek( )`. I have this variable
> this is a pointer to a pointer:
>
> // in C
>
> int **multi_indirec;
>
> Back to euphoria. So i have this atom which is a pointer to a pointer. I
> tried to `peek( )` this atom so i have just a pointer. This caused a
> seqmentation fault. Is this Euphoria's fault or that of my code? Is there
any
> other way to access the value at the end of the pointer chain?
>
> ex
>
> atom ptr_to_ptr, ptr, value
>
> -- variables now have values/locations
>
> ptr = peek( ptr_to_ptr ) -- segmentation fault is here
> value = peek( { ptr, length( ptr ) } )
Hi Cense
I'm not sure, but is it possible that you are only peeking the first byte of
the "location"
I would imagine that your pointer is at least a 32-bit address??
Perhaps change....
ptr = peek( ptr_to_ptr ) <--- returns only one byte of your complete
address
to
ptr = peek4u(ptr_to_ptr)
Good luck!
Mark
|
Not Categorized, Please Help
|
|