943,718 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Marked Solved
  • Views: 8098
  • C RSS
You are currently viewing page 3 of this multi-page discussion thread; Jump to the first page
Jul 31st, 2009
0

Re: String to unsigned char array

I just wrote this code to give you an idea for how to do conversion manually (In fact this logic can be used in any language).
you may have to change the code as per you requirements: ...

Done some changes for unsigned char and j++

  1. #include<stdio.h>
  2. #include<ctype.h>
  3. int main ( ){
  4. char *bigHexa = "412073696d706c6520737472696e6720412073696d706c6520737";
  5. unsigned char decimalOfHexa = [100]; // change
  6. int i = 0, j = 0;
  7. while(true) {
  8. decimalOfHexa[j] = getDecimal(bigHexa[i], bigHexa[i+1])
  9. if(bigHexa[i+2] == '\0') break;
  10. i = i + 2;
  11. j++; // change
  12. }
  13. }

In java I have least experience so no idea about built in functions.
Last edited by Luckychap; Jul 31st, 2009 at 9:33 am.
Reputation Points: 83
Solved Threads: 61
Posting Pro in Training
Luckychap is offline Offline
442 posts
since Aug 2006
Aug 3rd, 2009
0

Re: String to unsigned char array

Thx to all ...
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Curgol is offline Offline
7 posts
since Jul 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: Need help with structure write to file
Next Thread in C Forum Timeline: Searching a String from a structure which is saved in a text file





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC