How do you print the value of a pointer to a pointer?
How do you print the contents of a memory location given a pointer to a pointer to the location?
ie:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
RPC_STATUS status;
RPC_WSTR stringBinding; // I guess
RPC_WSTR ObjectUuid;
RPC_WSTR ProtSeq;
RPC_WSTR NetworkAddr;
RPC_WSTR EndPoint;
RPC_WSTR NetworkOptions;
status = RpcStringBindingCompose( // The RpcStringBindingCompose function creates a string binding handle.
NULL,
(RPC_WSTR)"ncacn_ip_tcp",
(RPC_WSTR)"192.168.1.2",
(RPC_WSTR)"2000",
NULL,
&stringBinding
);
if(status==RPC_S_OK) RhinoApp().Print("RpcStringBindingCompose = SUCCESS!!!\n");
RhinoApp().Print("stringBinding = ");
RhinoApp().Print((char*)stringBinding);
RhinoApp().Print("\n");
RhinoApp().Print("\n");
status = RpcStringBindingParse(
stringBinding,
(RPC_WSTR*)ObjectUuid,
(RPC_WSTR*)ProtSeq,
(RPC_WSTR*)NetworkAddr,
(RPC_WSTR*)EndPoint,
(RPC_WSTR*)NetworkOptions
);
if(status==RPC_S_OK) RhinoApp().Print("RpcStringBindingParse = SUCCESS!!!\n");
if(status==RPC_S_INVALID_STRING_BINDING) RhinoApp().Print("RpcStringBindingParse = The string binding is not valid.\n");
RhinoApp().Print("ProtSeq = ");
RhinoApp().Print((char*)ProtSeq);
RhinoApp().Print("\n");
RhinoApp().Print("\n");
|
The result is:
RpcStringBindingCompose = SUCCESS!!!
stringBinding = ncacn_ip_tcp:
RpcStringBindingParse = SUCCESS!!!
ProtSeq = @ά
Where as I needed:
RpcStringBindingCompose = SUCCESS!!!
stringBinding = ncacn_ip_tcp:
RpcStringBindingParse = SUCCESS!!!
ProtSeq = ncacn_ip_tcp:
cout << (*(*pointerToAPointer));
For example,
1 2 3 4 5 6 7 8 9 10 11
|
#include <iostream>
int main()
{
int x = 7;
int* pointerToX = &x;
int** pointerToPointerToX = &pointerToX;
std::cout << *(*pointerToPointerToX);
return 0;
}
|
I think it works also without parentheses:
cout << **pointerToAPointer;
Thanks!
The fix was:
1 2 3 4 5 6 7 8
|
status = RpcStringBindingParse(
stringBinding,
&ObjectUuid,
&ProtSeq,
&NetworkAddr,
&EndPoint,
&NetworkOptions
);
|
Topic archived. No new replies allowed.