String to unsigned char array

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Aug 2006
Posts: 319
Reputation: Luckychap is on a distinguished road 
Solved Threads: 42
Luckychap's Avatar
Luckychap Luckychap is offline Offline
Posting Whiz

Re: String to unsigned char array

 
0
  #21
Jul 31st, 2009
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.
When you think you have done a lot, then be ready for YOUR downfall.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 7
Reputation: Curgol is an unknown quantity at this point 
Solved Threads: 0
Curgol Curgol is offline Offline
Newbie Poster

Re: String to unsigned char array

 
0
  #22
Aug 3rd, 2009
Thx to all ...
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 1916 | Replies: 21
Thread Tools Search this Thread



Tag cloud for C
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC