Reidacus
Reidacus

Reputation: 103

C Programming in OPNET

I'm starting some work into manual programming of nodes in OPNET however I am having a few troubles. I'm getting some information from packets and storing them in variables and want to output this to the simulation console. When I add the line puts(bcast_info) I get the following error.

C:/Users/Andrew/op_models/traffic_source.pr.c(74) : warning C4047:
'function' : 'const char *' differs in levels of indirection from
'Objid' C:/Users/Andrew/op_models/traffic_source.pr.c(74) : warning
C4024: 'puts' : different types for formal and actual parameter 1

Prior to adding the line mentioned above, the simulation worked perfectly and I got the basic text output. This is my code so far.

 static void route_pk(void)
    {
    Packet * pkptr;
    Objid bcast_info;
    FIN(route_pk());
    pkptr = op_pk_get(op_intrpt_strm ());
    bcast_info = op_pk_bcast_get (pkptr);
    printf ("Hello! \n");
    puts("Hello from puts");
    puts(bcast_info);
    op_pk_send (pkptr, 1);
    FOUT;
    }

I appreciate that OPNET is a variation on the C language with some of its own methods etc but any help on what the errors actually mean and potential fixes would be much appreciated. Please be aware that I have never worked with C / C++ or this OPNET language before.

Upvotes: 0

Views: 1177

Answers (1)

Allen Kim
Allen Kim

Reputation: 71

Please don't use the print() function. Use the op_prg_odb_print_major() function.

Objid is a special data type in Modeler. You can't print it to screen.

Upvotes: 0

Related Questions