adding rows dynamically and then retreiving it - appends some unknown characters
Niraj Mansingka
nirajm____npi.stpn.soft.net
Tue May 15 23:16:34 CEST 2001
Hi all and Frank,
Sorry to disturb u as it might a simple problem.
I added a row to a table and viewed it using a MIB Browser. It showed the
right value. Then, retreived it in the application and sent it to the std
out. The std out prints some garbage characters appended to the output. Can
u identify the reason for the garbage value? I am using the following
code(Please note the comments before each piece of code). Any comments to
the style of coding and my understanding of the Agent application is
welcome.
//FOR ADDING A ROW TO THE MIBTABLE DYNAMICALLY
if ( MibTable * myTable =
dynamic_cast<MibTable*>(mib->get("1.3.6.1.4.1.1189.2.2.1")) )
{
MibTableRow* myRow = myTable->add_row("3");
myRow->get_nth(0)->replace_value(new Oidx("1.3.6.1.4.1.1189.2.2.1.1"));
myRow->get_nth(1)->replace_value(new OctetStr("This is the second
addition of pre val"));
myRow->get_nth(2)->replace_value(new OctetStr("This is the second
addition of post val"));
}
//FOR RETREIVING THE VALUE OF THE MIBTABLE OBJECT
if ( MibTable * myTable = dynamic_cast<MibTable
*>(mib->get("1.3.6.1.4.1.1189.2.2.1")) )
{
OidList<MibTableRow>* tableRowList = myTable->rows();
MibTableRow* myFirstRow = tableRowList->first();
myFirstRow = tableRowList->find_next( myFirstRow->key() );
OctetStr leafStrValue;
myFirstRow->get_nth(1)->get_value().get_value(leafStrValue);
cout << "the value of the str is ****" << leafStrValue.data() <<
"****" << endl;
}
//THE OUTPUT OF THE STDOUT IS
the value of the str is ****This is the second addition of pre
val????||||||||||||||a****
rgds,
Niraj
More information about the AGENTPP
mailing list