On Mon, 2005-06-06 at 12:07, Alaios wrote:
> Hi .. .i am trying to pass oid as a parameter to a
> function..

> myfunction(oid *myoid){
>   size_t length_myoid= sizeof(myoid)/sizeof(oid)

Nope.
That will take the size of the OID *pointer*,
not the full array.  You need to pass the length of
the array as a separate parameter:


   int main(int argc,char **argv) {
     oid myoid[]={1.3.6.8.9....};
     myfunction(myoid, OID_LENGTH(myoid));
   }

   myfunction(oid *myoid, size_t length_myoid) {
       /* etc, etc */
       snmp_add_null_var(pdu,myoid,length_myoid);
   }



>   snmp_add_null_var(pdu,myoid[0],length_myoid);
>   //this returns segmentation fault

Not surprising - it's completely wrong.

Dave



-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.  
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to