Is there a function that returns the ASCII value of a character? (C++)

前端 未结 5 1123
生来不讨喜
生来不讨喜 2020-12-31 05:14

I need a function that returns the ASCII value of a character, including spaces, tabs, newlines, etc...

On a similar note, what is the function that converts between

5条回答
  •  渐次进展
    2020-12-31 05:31

    char c;
    int ascii = (int) c;
    s2.data[j]=(char)count;
    

    A char is an integer, no need for conversion functions.

    Maybe you are looking for functions that display integers as a string - using hex, binary or decimal representations?

提交回复
热议问题