On Tue, 11 Jan 2005 10:35:22 +0100 Ola wrote:
OC> Hi!
OC> The problem arises for example when i want to return just bit 20 set.
OC> (0x000008)  - byte[0] = 0x00, byte[1] = 0x00, byte[2] = 0x08(no problem
OC> when bits are set also in the two first bytes...)
OC> 
OC> "
OC>   OID_Print(pOutputOID);
OC>   printf("string\n");
OC>   printf("%.3s\n", &byte[0]);
OC> "
OC> 
OC> The code above will result in just "string\n\0", i cannot figure out how to
OC> work around this....

use a loop printing each byte instead of using a string...

for(int i = 0; i < byte_len; ++i)
   printf("%02x", byte[i]);
printf("\n");

-- 
Robert Story; NET-SNMP Junkie
Support: <http://www.net-snmp.org/> <irc://irc.freenode.net/#net-snmp>
Archive: <http://sourceforge.net/mailarchive/forum.php?forum=net-snmp-coders>

You are lost in a twisty maze of little standards, all different. 


-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to