Connecting Tech Pros Worldwide Help | Site Map

pointer?

  #1  
Old November 21st, 2008, 02:25 PM
Michael Sgier
Guest
 
Posts: n/a
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

  #2  
Old November 21st, 2008, 02:45 PM
maverik
Guest
 
Posts: n/a

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?
  #3  
Old November 21st, 2008, 02:45 PM
maverik
Guest
 
Posts: n/a

re: pointer?


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

  #4  
Old November 21st, 2008, 02:55 PM
Michael Sgier
Guest
 
Posts: n/a

re: pointer?


Hi
that's all I have:

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

Thanks Michael

  #5  
Old November 21st, 2008, 03:05 PM
maverik
Guest
 
Posts: n/a

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 *
  #6  
Old November 21st, 2008, 07:25 PM
Fred
Guest
 
Posts: n/a

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
pointer to void property aegis answers 16 November 15th, 2005 03:07 AM
Some pointer quiestions again junky_fellow@yahoo.co.in answers 16 November 14th, 2005 11:19 PM
strange pointer problem, now ansi example Bruno van Dooren answers 3 July 28th, 2005 09:35 PM
Pass-by-reference instead of pass-by-pointer = a bad idea? Mr A answers 110 July 23rd, 2005 07:17 AM
Problem with template ctors (smart pointer) Carsten Spieß answers 4 July 22nd, 2005 01:37 PM