On 20/07/07, vincenzobonvino@tin.it wrote:
> const oid data[] = {1,3,6,1,2,1,2,1,0};
> char res[100];
> const netsnmp_variable_list var;
> int res2 = snprint_value(res,sizeof(res),data,OID_LENGTH(data ),&var);


But you haven't got a value in 'var' to be printed.


> The result is
> "Wrong Type (should be INTEGER): Variable has bad type",


That's right - the routine is expecting 'var' to contain an INTEGER varbind,
but you've given it an empty varbind structure.

> but if i do a get on that OID it gives me the correct value.


Because the GET fills in the value before trying to print it.


> What am I missing?


You can't print a value that isn't there to be printed.

Dave

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/...net-snmp-users