pointer?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michael Sgier

    pointer?

    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(g PlaneV) != 1026)
    XPLMSetDatai(gP laneV, 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

    #2
    Re: pointer?

    On Nov 21, 5:16 pm, Michael Sgier <sg...@nospam.c omwrote:
    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 ?

    Comment

    • maverik

      #3
      Re: pointer?

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

      Comment

      • Michael Sgier

        #4
        Re: pointer?

        Hi
        that's all I have:



        Thanks Michael

        Comment

        • maverik

          #5
          Re: pointer?

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

          typedef void * XPLMDataRef;

          So,
          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 *

          Comment

          • Fred

            #6
            Re: pointer?

            On Nov 21, 6:16 am, Michael Sgier <sg...@nospam.c omwrote:
            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(g PlaneV) != 1026)
                    XPLMSetDatai(gP laneV, 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


            Comment

            Working...