Your code is very similar to and probably based on
Query MAC address from 3com switch (final solution). Note that the author of that code used
printf.
Try using
printf and see if the numbers come out correctly. You may have to use a numeric printf conversion code.
HTH, --traveler