Connecting Tech Pros Worldwide Help | Site Map

pointer?

Michael Sgier
Guest
 
Posts: n/a
#1: Nov 21 '08
Hi
Declaration:

XPLM_API XPLMDataRef XPLMFindDataRef(
const char * inDataRefName);

Does this return a pointer?

So I try this:

XPLMDataRef gPlaneV = NULL;

gPlaneV = XPLMFindDataRef("sim/graphics/view/view_type");

if (XPLMGetDatai(gPlaneV) != 1026)
XPLMSetDatai(gPlaneV, 1026);


But this doesn't work. If the declaration returns a pointer so how can I
set it's value ( integer ) to 1026?
Many thanks and regards
Michael

maverik
Guest
 
Posts: n/a
#2: Nov 21 '08

re: pointer?


On Nov 21, 5:16*pm, Michael Sgier <sg...@nospam.comwrote:
Quote:
Hi
Declaration:
>
XPLM_API XPLMDataRef * * * * *XPLMFindDataRef(
* * * * * * * * * * * * * * * * * * const char * * * * * inDataRefName);
>
Does this return a pointer?
Sorry, I doesn't have libastral in my OS distribution. Can you provide
defenition of the type XPLMFindDataRef?
maverik
Guest
 
Posts: n/a
#3: Nov 21 '08

re: pointer?


On Nov 21, 5:35*pm, maverik <maverik.m...@gmail.comwrote:
Quote:
defenition of the type XPLMFindDataRef?
: D defInition

Michael Sgier
Guest
 
Posts: n/a
#4: Nov 21 '08

re: pointer?


Hi
that's all I have:

http://www.xsquawkbox.net/xpsdk/phpw...XPLMDataAccess

Thanks Michael

maverik
Guest
 
Posts: n/a
#5: Nov 21 '08

re: pointer?


On Nov 21, 5:49 pm, Michael Sgier <sg...@nospam.comwrote:From the link:

typedef void * XPLMDataRef;

So,
Quote:
XPLM_API XPLMDataRef XPLMFindDataRef(const char *inDataRefName);
Does this return a pointer?
Yes.

Accroding to 7.3.1.p1 of the ISO/IEC C++ Standard (2003)

Within the scope of its declaration,
a typedef-name is syntactically equivalent to a keyword and names the
type associated with the identifier in the way described in clause 8.
A typedef-name is thus a synonym for another type. A typedef-name
does
not introduce a new type the way a class declaration (9.1) or enum
declaration does.

So you can think of XPLMDataRef as a synonym for void *
Fred
Guest
 
Posts: n/a
#6: Nov 21 '08

re: pointer?


On Nov 21, 6:16*am, Michael Sgier <sg...@nospam.comwrote:
Quote:
Hi
Declaration:
>
XPLM_API XPLMDataRef * * * * *XPLMFindDataRef(
* * * * * * * * * * * * * * * * * * const char * * * * * inDataRefName);
>
Does this return a pointer?
>
So I try this:
>
XPLMDataRef * * * * * * gPlaneV = NULL;
>
gPlaneV = XPLMFindDataRef("sim/graphics/view/view_type");
>
if (XPLMGetDatai(gPlaneV) != 1026)
* * * * XPLMSetDatai(gPlaneV, 1026);
>
But this doesn't work. If the declaration returns a pointer so how can I
set it's value ( integer ) to 1026?
What do you mean by "it doesn't work" ?
Does the code fail to compile? If so, what is the error message?

If it does compile, does it crash? If so, what error message?

If it runs, how do you know it doesn't work?

Read the documentation, which includes:
"Write a new value to an integer data ref. This routine is a no-op if
the plugin publishing the dataref is disabled, the dataref is invalid,
or the dataref is not writable."

--
Fred Kleinschmidt


Closed Thread