Results 1 to 5 of 5

Thread: ascii code and accents

                  
   
  1. #1
    DCEmu Coder JMD's Avatar
    Join Date
    Apr 2004
    Location
    France
    Age
    49
    Posts
    83
    Rep Power
    0

    Default ascii code and accents

    hi,

    When I type this :
    Code:
    printf("%c, %s, %c, %i\n", 133, "à", "à", "à");
    the result is :
    Code:
    à, Ó, è, 4199050
    In extended ascci table, the code of 'à' is 133.

    How can I have the (extended) ascii code from a char string with accents ?

    My main goal is to use the ascii code to find letters in a texture to write a text with accent on screen.

    Doas another methode exist ?

    Thanks


  2. #2
    DCEmu Coder c99koder's Avatar
    Join Date
    Oct 2004
    Location
    East Windsor, NJ
    Age
    40
    Posts
    37
    Rep Power
    0

    Default Re: ascii code and accents

    you need to use single quotes around your characters, not double quotes.

    'c' is a character, while "s" is a string (pointer to an array of characters).

    -Sam

  3. #3
    DCEmu Coder JMD's Avatar
    Join Date
    Apr 2004
    Location
    France
    Age
    49
    Posts
    83
    Rep Power
    0

    Default Re: ascii code and accents

    Thanks Sam.

    But I tried this
    Code:
    printf("%c, %s, %c, %i\n", 133, "à", 'à' , 'à');
    and the return is :
    Code:
    à, Ó, Ó, -32
    ???


  4. #4
    DCEmu Coder GPF's Avatar
    Join Date
    Apr 2004
    Location
    Texas
    Age
    52
    Posts
    796
    Rep Power
    78

    Default Re: ascii code and accents

    i ran into a similiar problem and this is what I used.

    Code:
    char a='à';
    int j=(int)a;
    int i=(int)a &0xFF;
    printf(" %c = %d not %d \n",a,i,j);
    and here is the output

    Code:
     à = 224 not -32
    Troy



  5. #5
    DCEmu Coder JMD's Avatar
    Join Date
    Apr 2004
    Location
    France
    Age
    49
    Posts
    83
    Rep Power
    0

    Default Re: ascii code and accents

    works fine

    Thanks.


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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