Hi Ashish,
Below is a sample code for ur case
Note: it is working fine.
printf("\nString to oid\n");
char names[SNMP_MAX_CMDLINE_OIDS];
oid name[MAX_OID_LEN];
size_t name_length;
name_length = MAX_OID_LEN;
int count;
strcpy(names, "1.3.6.1.4.1.33830.1");
snmp_parse_oid(names, name, &name_length);
for (count = 0; count < name_length; count++) {
printf("\nString = %ld\n",name[count]);
}
--- On Tue, 16/2/10, Dave Shield <[email protected]> wrote:
From: Dave Shield <[email protected]>
Subject: Re: [convert string as oid]
To: "Ashish vashishtha" <[email protected]>
Cc: "Vivek Singh Bhadauria" <[email protected]>,
[email protected]
Date: Tuesday, 16 February, 2010, 7:37 PM
On 16 February 2010 13:43, Ashish vashishtha
<[email protected]> wrote:
> i think snmp_parse_oid() function convert oids like ABCD to oid.
Whereas I think that snmp_parse_oid() converts a string representation
of an OID (in any of a variety of formats - including dotted-numeric)
into a numeric array.
May I humbly suggest that my beliefs are perhaps a shade more
likely to bear a passing resemblance to the actuality.....
(or in plain English - you're wrong!)
> when i am trying this function with
> string str that contains 1.3.6.1.1.133.5 i am getting garbage values.
Then there must be something wrong with your code.
If you show us what you've got, maybe we could suggest
where the error is.
Dave
Your Mail works best with the New Yahoo Optimized IE8. Get it NOW!
http://downloads.yahoo.com/in/internetexplorer/------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users