Thread: what does the arrow signify?

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    6

    Question what does the arrow signify?

    I have generated some C code from an SAP system which I am attempting to modify. I am new to C coding, but have experience in lots of other languages.

    The code listed in Section A is used in a call to the code to Section B.

    I am trying to establish the format required by the logon() function since the code in Section A seems to grouping a set of parameters in to one.

    Can someone please explain the significance of the arrow?

    I think the parameter format is being passed to logon() is something like this:

    RFC_HANDLE logon ("destination client password language", "gateway_host gateway_service")

    i.e. two groups of space separated parameters delimited by commas; it this correct?

    CODE SECTION A

    RfcOptions->destination = lDestination;
    RfcOptions->client = lClient;
    RfcOptions->user = lUser;
    RfcOptions->password = lPassword;
    RfcOptions->language = lLanguage;

    RfcConnoptCpic->gateway_host = lGwhost;
    RfcConnoptCpic->gateway_service = lGwservice;


    CODE SECTION B

    RFC_HANDLE logon(
    RFC_OPTIONS *RfcOptions,
    RFC_CONNOPT_CPIC *RfcConnoptCpic)
    {
    ...

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    -> means access structure member by pointer.

    RfcOptions->destination = lDestination;

    RfcOptions is the pointer to struct.
    destination is the struct member
    lDestination is the new value for that member
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    oh yeah btw. you will call your function like this....

    RFC_HANDLE MyHandle= logon( RfcOptions,RfcConnoptCpic)
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  4. #4
    Registered User
    Join Date
    Dec 2001
    Posts
    88
    a->b
    is the short way to say
    (*a).b

    Hope you don't mind my bad english, I'm Austrian!

  5. #5
    Registered User
    Join Date
    Jan 2002
    Posts
    6
    Thank you all, that helps.

    So, if we filled in the parameters in the call to logon(), how would they look?

    The reason I ask is that I am going to have pass the parameters from outside of the c program. I can do this by compling the C and building a DLL, so I need to establish the format of the parameters being passed from the above mentioned code.

    Very grateful for any guidance on this.

  6. #6
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    I already told you but that was c++....

    look.... you have 2 structures. a structure is an aggregate type composed of other types. Your logon function takes two params.
    they are....
    RFC_OPTIONS * which is a pointer to a struct type RFC_OPTIONS
    RFC_CONNOPT_CPIC * which is a pointer to a struct type RFC_CONNOPT_CPIC

    somewhere in your code you may have something like this...
    Code:
    RFC_HANDLE MyHandle;
    RFC_OPTIONS myRfcOptions; // make a structure
    RFC_OPTIONS* RfcOptions; // pointer to struct
    RFC_CONNECT_CPIC myRfcConnoptCpic;
    RFC_CONNECT_CPIC* RfcConnoptCpic;
    RfcOptions=&myRfcOptions;
    RfcConnoptCpic=&myRfcConnoptCpic; // pointers now point at the structs
    .
    .
    .
    // now fill out the struct fields to the values needed in the functions
    RfcOptions->destination = lDestination; 
    RfcOptions->client = lClient; 
    RfcOptions->user = lUser; 
    RfcOptions->password = lPassword; 
    RfcOptions->language = lLanguage; 
    
    RfcConnoptCpic->gateway_host = lGwhost; 
    RfcConnoptCpic->gateway_service = lGwservice; 
    
    // now call the function
    MyHandle=logon(RfcOptions,RfcConnoptCpic)
    starting to see whats going on?
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  7. #7
    Registered User
    Join Date
    Jan 2002
    Posts
    6
    Thanks again, my problem is that the software I am using does not have an equivalent aggregate type. I need to be able to format a string in my external software to send the contents of:

    RfcOptions

    &

    RfcConnoptCpic

    I understand the pointer concept. What I need to know is what do these variables actually contain e.g:

    RfcOptions contains "Parm-1 Parm-2 Parm-3, Parm-4 Parm-5"

    or

    RfcOptions contains "Parm-1|Parm-2|Parm-3, Parm-4|Parm-5"

    or

    what?

    Sorry to be a pain!

  8. #8
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    I understand the pointer concept. What I need to know is what do these variables actually contain e.g:
    If this is a compiled external library then the headers for those structs should have been supplied.Or you should have documentation telling you what the structs contain so that you can replicate it.Where did you get the code you are trying to link to? are you sure you dont have the struct defs in a header they will look something like this...

    typedef struct
    {
    blah destination;
    blah client;
    blah user;
    blah password;
    blah language;
    }
    RFC_OPTIONS;
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  9. #9
    Sayeh
    Guest
    There are two methods by which you access fields in a structure. You either access the field directly


    Code:
    typedef struct
       {
       int   field1;
       int   field2;
       }myStruct
    
    
    int main(void)
       {
       myStruct  a;                         /* we have access to the structure itself */
    
       a.field1 = 5;                         /* access directly */
    
       return(0);
       }
    or you can access the field by reference (indirectly)--


    Code:
    int main(void)
       {
       myStruct  a;
    
       foo(&a);                               /* pass the _address_ of the structure */
    
       if(a.field1 == 5)
          {
          ...
          };
    
    
       return(0);
       }
    
    void foo(myStruct *b)
       {
       /* The address of the struct was passed */
       /* which means we _don't_ have direct   */
       /* access to the structure, we just have  */
       /* a pointer to it.  This means we must    */
       /*  "de-reference" or "indirectly access"   */
       /* the structure's fields.                            */
    
       b->field1 = 5;                     /* access field _through_ the pointer */
       }

    ----

    enjoy.

  10. #10
    Registered User
    Join Date
    Jan 2002
    Posts
    6
    Hi All

    Thank you for your replies once again.

    I have worked out what I need to pass within the C program and it is consistent with what you have kindly provided.

    My problem relates to when I have to call this function from outside of C. When I build DLL from the source code I am able to call the function directly from my external software.

    What I failing to establish is what the extact format of the function call should be with values for the parameters being supplied.

    logon ("parameter value 1", "parameter value 2")

    where:
    parameter value 1 = sub-parm-1_1 + sub-parm-1_2
    parameter value 2 = sub-parm-2_1 + sub-parm-2_2

    so

    What does parameter value 1/2 need to be as a string?

    'VALUE1 VALUE2'
    'VALUE3 VALUE4'

    or

    'VALUE1,VALUE2'
    'VALUE3,VALUE4'

    so the call would look like this at execution time:

    logon("'VALUE1 VALUE2'",'VALUE3 VALUE4')

    or

    logon("'VALUE1,VALUE2'",'VALUE3,VALUE4')

    so I suppose the question is really how do I send these groups of parameters into these two parameters that are decalred on the function call
    directly, not from with in C?

    Sorry to labour the point, but I do not have a lot of options here to call the function.

    All guidance is very much appreciated.

    Neil

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Ascii code for arrow keys
    By beginner in forum C Programming
    Replies: 1
    Last Post: 11-07-2002, 01:29 PM
  2. Arrow keys!
    By Paninaro in forum C Programming
    Replies: 8
    Last Post: 06-26-2002, 07:39 PM
  3. msdos arrow keys?
    By seditee in forum Game Programming
    Replies: 3
    Last Post: 05-07-2002, 11:29 PM
  4. Arrow keys
    By Nutshell in forum C Programming
    Replies: 5
    Last Post: 03-27-2002, 11:49 AM
  5. Using Arrow Keys in Windows
    By Xterria in forum Game Programming
    Replies: 4
    Last Post: 10-22-2001, 08:21 PM