Menu

Extended ASCII charters to decimal conversion

prem kumar
2019-09-25
2019-09-25
  • prem kumar

    prem kumar - 2019-09-25

    Hi All,

    Is there any way to convert extended ASCII charters(from the range 128-255) to its corresponding decimal values programmatically?

    Brief:: standard ASCII charters ranging from 0-127 we can store it in simple character variable and we do the conversion like below example.

    e.x:1) for Standard ASCII charter to decimal conversion
    char myString [] = "+"; // input is '+' corresponding decimal value is 43.
    printf("myString decimal val = %d, size = %d, %d\n",myString[0], sizeof(tmpBuffer));

    O/p: myString decimal val = 43, size = 2

    2) e.x: for Extended ASCII charter to decimal conversion
    char myString [] = "á"; // input is 'á' corresponding decimal value is 160.
    printf("myString decimal val = %d, size = %d, %d\n",myString[0], sizeof(tmpBuffer));

    O/p: myString decimal val = -61, size = 3

    in the above 2) e.x i am getting the decimal output value is -61 but actual is 160.

    Can anyone help me out how can i get the o/p as exact decimal value?

    Thanks in Advance..

     
  • prem kumar

    prem kumar - 2019-09-25

    Hi Please find the attached code for the issue i faced. Can anyone hel me out from this.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.