ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I send below string which is in hex format to server.In between there is one abstract module before sending to server
unsigned char pTAG[] = "9F34031E0300";
In server I am getting in output as
"39463334303331453033303039".
My question is What conversion need to done with pTAG I can get "9F34031E0300". I tried converting into ascii but of no use.
My handy programmer's calculator (app) tells me that the hex-string you provided translates to decimal 175045739414272.
So, I'm not sure where that number you're seeing on the server side came from, and I'm not going to try to dumpster-dive right now to find out ... ahh, wait a minute. I see it.
In the string you show, each two-character pair appears to correspond to one of the characters in the hex string, with "39" tacked on to the end for good measure. So, the code simply converted an ASCII(?) character string from one representation to another. It did not properly interpret it as hexadecimal.
The scanf()-based solution described in a previous post should take you right where you need to go. The correct answer that you're looking for is the number given in this post.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.