On Tue, 2005-07-19 at 19:40 +0200, Torben Surmer wrote:
> I have built a simple table like explained in the data_set example.
> My problem is, I do not understand how to reassign the MIB values.
> netsnmp_set_row_column(row, 2, ASN_OCTET_STR, sz,strlen(sz));
> netsnmp_table_dataset_add_row(table_set, row);
> The snmpwalk over the table works fine and says "hello" to me.
> later sz changes to strcpy(sz,"bye bye");
And do you call
netsnmp_set_row_column(row, 2, ASN_OCTET_STR, sz,strlen(sz));
again?
Remember that this is basically just *copying* the sz string into
the table. It doesn't take any notice of what happens to the sz
buffer after that.
Think of it like:
char row2[BUFSIZ], sz[BUFSIZ];
strcpy( sz, "hello" );
strcpy( row2, sz );
strcpy( sz, "bye bye" );
The 'row2' buffer will still contain "hello".
That's effectively what's happening here.
Dave
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders