Search code examples
ccharintascii

How to get a char from ASCII number


Hello. Im reading file using FILE and reading that using fgetc to read that.

fgetc function returns me int value of my chars in ASCII.

Now i want to print that data in char values.

How to convert my ascii numbers to chars?


Solution

  • You most likely don't need any conversion. If the native character set on your system is ASCII (which is the most common) then no conversion is needed. 'A' == 65 etc.

    That means to print a character you just print it, with e.g. putchar or printf or any other function that allows you to print characters.