[AGENT++] how to allocate vb binds in dynamic

Jerry OELoo oyljerry at hotmail.com
Wed Jan 26 09:35:00 CET 2005


Hi Frank
   Thanks for your help
   i have understood your mean, and i have tested your method ,it works 
fine to me 
   but, as your code show Vbx vbs[10] the number of array should be a 
constant (such as 10)
   so ,i want to use the vbs[num],here ,num is a dynamic number (it is 
confirmed in runtime)
so as c++ says ,i should use the heap space ,so i use Vbx* pVbs = new 
Vbx[num]; but ,i do not how to access the array (i can access the array 
with pVbs->set_oid(getOid) but how can i access the second member ,i use 
pVbs[2]->set_oid(getOid) or pVbs++; both error! )
   at same time 
   if i use Vbx Vbs[6];then Vbx[i]->set_oid(getOid); i++ it is right !
   but if  Vbx* pVbs = new Vbx[num]; Vbx[num]->set_oid(getOid); num++ it is 
error !


>Hi Jerry,
>
>You do not give a complete example, so it is hard to help.
>Have you read Bjarne Stroustrup's book "The C++ Programming Language"
>yet?
>
>To following, for example, should work:
>
>Vbx vbs[10];
>vbs[0].set_oid("1.3.6.1");
>vbs[1].set_oid("1.3.6.2");
>
>Best regards,
>Frank

_________________________________________________________________
与联机的朋友进行交流,请使用 MSN Messenger:  http://messenger.msn.com/cn  




More information about the AGENTPP mailing list