Re: how to fetch/convert counter64 value 2 string in C
johan <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
Thanks Dave, your code works pretty well. Cheers, Johan Dave Shield wrote: > On 05/02/07, johan <[email protected]> wrote: > >> But, I can't fetch counter64 value and convert to char/string. I think >> caused of struct of counter64 is different with counter32. >> > > That's correct. > A Counter32 object is held as a simple integer ("long") variable, > because this is pretty-much universally supported. > But it's not always possible to represent a 64-bit quantity in > a single integer variable - not even a "long" or "long long". > > So Counter64 is represented as a structure, containing *two* > 32-bit values. > > If you can use 64-bit variables, then you can extract this > value using something like: > > long long val64; > val64 = vars->val.counter64->high; > val64 <<= 32; > val64 += vars->val.counter64->low; > asprintf(&buf1,"%u",val64); > > [Untested!] > > > Or else you could use the routine 'snprint_value' > which is designed for exactly this purpose anyway. > > Dave > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier. > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Net-snmp-users mailing list > [email protected] > Please see the following page to unsubscribe or change other options: > https://lists.sourceforge.net/lists/listinfo/net-snmp-users > > > > ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Net-snmp-users mailing list [email protected] Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users