That worked better for the bookTable_get_first_data_point method.  Now I
am trying to use the my_loop_context in the
bookTable_get_next_data_point(void **my_loop_context,
                              void **my_data_context,
                              netsnmp_variable_list * put_index_data,
                              netsnmp_iterator_info *mydata)
{

    char this_index[SPRINT_MAX_LEN];
 
   //this printf shows the setting from the get_first_data_point method
    printf("my_loop_context = %s\n",(char *)*my_loop_context);
  
    snprintf(this_index, strlen((char *)*my_loop_context),
       "%s",(const char*)*my_loop_context); 
 
    //this printf does not show the setting even though it should
    printf("bookTable_get_next_data_point this index %s \n",this_index);

I don't seem to be able to access the data from my_loop_context in order
to increment to the next datapoint.
-----Original Message-----
From: Dave Shield [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 19, 2006 11:08 AM
To: Toth, Gregory S
Cc: net-snmp-coders@lists.sourceforge.net
Subject: Re: How to index a table with a string

On 19/09/06, Toth, Gregory S <[EMAIL PROTECTED]> wrote:

>     char this_index[SPRINT_MAX_LEN]  = "title1";
>     snmp_set_var_value(vptr, (u_char *) &this_index ,
>                        sizeof(this_index) );

try
       snmp_set_var_value( vptr, this_index, strlen(this_index));

The size of 'this_index' is SPRINT_MAX_LEN, but the index string doesn't
use all of this buffer.  And 'this_index' is already a pointer to the
value, so you don't need to take the address again.

Dave

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to