µTasker Forum

µTasker Forum => µTasker general => Topic started by: thamanjd on May 26, 2008, 09:40:20 AM

Title: Looking for string to unsigned short code (ansi c).
Post by: thamanjd on May 26, 2008, 09:40:20 AM
Can anybody point me to or like to share code for string to unsigned short (16bit) routine?  this will be for reading an edit box from a web page to configure a tcp port number.
Title: Re: Looking for string to unsigned short code (ansi c).
Post by: mark on May 26, 2008, 10:40:46 AM
Hi

You should be able to use fnDecStrHex() to do this.

Eg:
usValue = (unsigned short)fnDecStrHex("12345");

If the input is in ASCII Hex the equivalent fnHexStrHex() can be used.

Eg:
usValue = (unsigned short)fnHexStrHex("aB24");

aB is used to show that the input is case-insensitive

Regards

Mark
Title: Re: Looking for string to unsigned short code (ansi c).
Post by: thamanjd on May 30, 2008, 09:47:23 AM
Thanks, that worked out great.

JD