×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor
    Join Date
    Aug 2005
    Location
    California
    Posts
    87

    Char->Binary->Char

    How can i convert a hexadecimal or a binary decimal to it's corresponding character?

    here's how i convert a char to binary:

    Code:
    TInt value;
    TBuf<20> toOct;
    TBuf<20> File;
    TLex iLex;
    
    _LIT(he, "Hello");
    File.Copy(he);
    
    toOct.Num(File[3], EBinary);//<--File is a binary string
    iLex = toOct;
    iLex.Val(value); //<--value is now an integer
    how can i convert value to back to it's corresponding character?

    thanks a lot!
    readio active sago project

  2. #2
    Regular Contributor
    Join Date
    Jun 2005
    Location
    Philippines
    Posts
    163

    Smile Re: Char->Binary->Char

    I think you should use HBufC

    TInt approxLength = 10;
    HBufC* numText = HBufC::NewLC( approxLength );
    numText->Des().AppendNum( numberYouWantToConvert );

    // use numText

    CleanupStack::PopAndDestroy( numText );

    Please check docs for member functions of TPtr16.

  3. #3
    Regular Contributor
    Join Date
    Aug 2005
    Location
    California
    Posts
    87

    Re: Char->Binary->Char

    thanks ryan.

    but i need something like this:

    if value = 104,
    then i should bring it back to its corresponding character 'D'.
    readio active sago project

  4. #4
    Regular Contributor
    Join Date
    Jun 2005
    Location
    Philippines
    Posts
    163

    Smile Re: Char->Binary->Char

    Does
    TChar.TranslateFromUnicode(TUint &aCode, TEncoding aEncoding) const;
    help? If it does please repost again, or if you find another solution just post it here for everyone to see

Similar Threads

  1. socket read hangs until socket is closed
    By camroe in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2005-07-21, 09:44
  2. unsigned char to hex
    By nicholasgaye in forum Symbian
    Replies: 0
    Last Post: 2005-06-09, 13:14
  3. Replies: 0
    Last Post: 2004-03-19, 02:58
  4. EXPORT error when doing armi build HELP!
    By al3ph in forum Symbian
    Replies: 0
    Last Post: 2002-12-09, 00:19

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×