Hi,
I am using a conversion from int to char to use it with SNMP.
In this moment I use:
int proc=45; // here cam be any value from 1 to 255
string cProc="";
cProc+=Convert.ToChar(proc);
mib_write(computer,oid,new Universal(cProc));
but the problem is when I use proc value between 127 to 159, the cProc
values are all the same -> ""
I changed to:
[StructLayout(LayoutKind.Explicit)]
struct IntToCharCast
{
[FieldOffset(0)]
public int i;
[FieldOffset(0)]
public char f;
};
IntToCharCast caster;
int iProc=45;// here cam be any value from 1 to 255
char cProc;
caster.i = iProc;
cProc=caster.f;
mib_write(computer,oid,new Universal(cProc));
and I get the same values.
What I am doing wrong ?
Thank you,
Dan
*** Sent via Developersdex http://www.developersdex.com ***