I tried this and instead of converting the hexadecimal to an ASCII
string, I just get the hexadecimal output in string format, 
i.e. instead of converting 01 15 33 30 43 6F 61 74 65 64 5F 50 61 70 65
72 to "30Coated_Paper" it converts it to " 15 33 30 43 6F 61 74 65 64 5F
50 61 70 65 72" 

-----Original Message-----
From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of William W.
Fisher
Sent: Wednesday, July 18, 2007 5:28 AM
To: InterMapper Discussion
Subject: Re: [IM-Talk] Convert hexadecimal to string

Levinson, Don A. wrote:
> I am trying to convert a hexadecimal SNMP variable to a string and
then
> extract a substring.
> String variables in the HP PML MIB are prepended by 0x0115 so they
come
> across as hex, I want to read the string, strip off the first two
bytes
> and then print the output.
> 
>       TRAY1_MEDIA_NAME,
> 1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.3.3.1.4,       HEXADECIMAL,    "Media
Name"
>       PAPER_NAME,                     (substr($TRAY1_MEDIA_NAME, 2)),
> CALCULATION, "Type of media"

In the function invocation of substr, put the first argument in quotes.
Without the quotes, the argument is being passed
as a numeric argument.

PAPER_NAME, (substr("$TRAY1_MEDIA_NAME", 2)), CALCULATION, "Type of
media"

This is a known problem with the function calling system; there are no
typed variables, so you have to hint in the
function call via quotes that you want to pass the argument as a string.

Regards,

Bill Fisher
Dartware, LLC
____________________________________________________________________
List archives: 
http://www.mail-archive.com/intermapper-talk%40list.dartware.com/
To unsubscribe: send email to: [EMAIL PROTECTED]

____________________________________________________________________
List archives:
http://www.mail-archive.com/intermapper-talk%40list.dartware.com/
To unsubscribe: send email to: [EMAIL PROTECTED]

Reply via email to