Hello everyone...
I'm trying to manipulate by my self the value of an object and when it's a string there is not a problem for example sysName, sysDescr but when I try to get the value for example of the NumInterfaces wich is an integer value I'm not able to get it following the same structure as in a string type, I want to get it because I need to do some mathematical operations with those values...I've tried alot of things but none of them seems to be the correct way and by the way when I try to get the MAC address using this procedure it doesn't work too I'm sure that I'm doing something bad I hope that any of you guys can help me...I just wan to get the value in a variable so I can manipulate it, just that...thank's alot
/* manipuate the information ourselves */
for(vars = response->variables; vars; vars = vars->next_variable) {
int count=1;
if (vars->type == ASN_OCTET_STR) {
char *sp = (char *)malloc(1 + vars->val_len);
memcpy(sp, vars->val.string, vars->val_len);
sp[vars->val_len] = '\0';
printf("value #%d is a string: %s\n", count++, sp);
free(sp)
for(vars = response->variables; vars; vars = vars->next_variable) {
int count=1;
if (vars->type == ASN_OCTET_STR) {
char *sp = (char *)malloc(1 + vars->val_len);
memcpy(sp, vars->val.string, vars->val_len);
sp[vars->val_len] = '\0';
printf("value #%d is a string: %s\n", count++, sp);
free(sp)
Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2ยข/min or less.