| | |
String to unsigned char array
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
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++
In java I have least experience so no idea about built in functions.
you may have to change the code as per you requirements: ...
Done some changes for unsigned char and j++
c Syntax (Toggle Plain Text)
#include<stdio.h> #include<ctype.h> int main ( ){ char *bigHexa = "412073696d706c6520737472696e6720412073696d706c6520737"; unsigned char decimalOfHexa = [100]; // change int i = 0, j = 0; while(true) { decimalOfHexa[j] = getDecimal(bigHexa[i], bigHexa[i+1]) if(bigHexa[i+2] == '\0') break; i = i + 2; j++; // change } }
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.
![]() |
Similar Threads
- How to convert char string of Hex characters to unsigned char string of binary data (C)
- Howto convert unsigned char into unsigned int (C++)
- Storing Hex values in dynamically allocated char array (C)
- Problem with a string (char array) and self made strcpy (C++)
- quick question: how to 'null' blocks of an unsigned char array (C++)
- Copy a string to a 2d array of type char (C++)
- assigning a TCHAR char array to std::string (C++)
- Trying to create a method to convert string letters into a two dimensional array (Java)
- two-dimensional char array (Java)
Other Threads in the C Forum
- Previous Thread: Need help with structure write to file
- Next Thread: Searching a String from a structure which is saved in a text file
Views: 1916 | Replies: 21
| Thread Tools | Search this Thread |
Tag cloud for C
#include * append array arrays bash binarysearch changingto char character cm copyanyfile copypdffile createprocess() database directory drawing dynamic execv feet fgets file floatingpointvalidation fork framework function functions getlogicaldrivestrin givemetehcodez global grade graphics gtkwinlinux histogram homework i/o ide include infiniteloop initialization input interest intmain() iso keyboard kilometer lazy license linked linkedlist linux list looping loopinsideloop. lowest matrix meter microsoft mqqueue mysql oddnumber odf open openwebfoundation overwrite pause pdf pointer pointers posix power process program programming pyramidusingturboccodes read recursion recv recvblocked reversing segmentationfault single socket socketprogramming spoonfeeding standard strchr string student suggestions system test testing threads unix urboc user whythiscodecausesegmentationfault win32api windowsapi





