address & pointer 
Author Message
 address & pointer

Hi All,

I wrote an OLE DB provider and it seems that the DataConvert method does not
work properly. This method takes a source pointer of type void and a
destination pointer of type void too. The purpose of this method is thus
obviously to copy data from the source pointer to the destination pointer.
However, when I debug, I notice that at the address of the source pointer is
the address of another pointer which contains, if I move in the memory, the
value I wish to copy to the destination pointer.
At the end of the process, the destination pointer contains strange
characters since it had copied obviously the value of the address and not
the value AT the address.

I would be glad if someone could tell me what I should do in order to get
the right value. Thus the one at the address given by the source pointer.

Thanks in advance

Francois



Mon, 20 Jun 2005 16:49:28 GMT  
 address & pointer

Quote:

> I wrote an OLE DB provider and it seems that the DataConvert method does
not
> work properly. This method takes a source pointer of type void and a
> destination pointer of type void too. The purpose of this method is thus
> obviously to copy data from the source pointer to the destination pointer.
> However, when I debug, I notice that at the address of the source pointer
is
> the address of another pointer which contains, if I move in the memory,
the
> value I wish to copy to the destination pointer.
> At the end of the process, the destination pointer contains strange
> characters since it had copied obviously the value of the address and not
> the value AT the address.

> I would be glad if someone could tell me what I should do in order to get
> the right value. Thus the one at the address given by the source pointer.

> Thanks in advance

> Francois

Francois,

I'm not an expert on OLE DB, but I looked up the documentation on
DataConvert in MSDN
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/oled...
oledbidataconvert__dataconvert.asp), which has this to say about the pSrc
and pDst parameters:

pSrc
    [in]
    A pointer to the source data. This is a pointer to the underlying data
type, based on the value of wSrcType. For example, this would be the
address of the BSTR pointer if wSrcType is DBTYPE_BSTR, not the BSTR
pointer itself.

pDst
    [out]
    A pointer to memory in which to return the destination data. As in the
case of pSrc, this is a pointer to the underlying data type, based on the
value of wDstType.

Perhaps the wDstType you are using actually indicates that pSrc is a
pointer to a pointer to the value you want and does not point directly to
the value you want?

--
Mark Levine
Visual C++ Team
This posting is provided "AS IS" with no warranties, and confers no
rights.



Tue, 05 Jul 2005 03:51:59 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. C Question - pointer & address-operator

2. Pointers & incrementing array address

3. DOS, pointers & flat addressing Question

4. pointers&&structures

5. Pointer && mmap on Linux help

6. How to map logical address to phisical address, and get the entry address of int 9 in windows 95&NT

7. Determining if a pointer has a bad address

8. passing address of a pointer as argument to a function

9. Pointer address and memory window problem

10. Changing pointer arg address from func?

11. confused with addressing / size of pointer

12. assign address to pointer array

 

 
Powered by phpBB® Forum Software