ASCII value for char or Int value for ASCII C

0

I need to find a value found by a rand in a file, I'm having a lot of problems because rand returns an integer and to search for a character in a file, the fgetc returns an integer corresponding to the ASCII of the character. I'm not even able to convert the integer to its ASCII value and nor convert the found ASCII number to char.

Can anyone give me a light? Thanks

    
asked by anonymous 02.11.2015 / 20:30

1 answer

0

You can create a variable of type char, and match it to the integer value, then just compare the char with the value of the file.

char c;

c = 125;

This happens because the char type is a 1 byte variable whose value goes from 0 ~ 255.

    
20.11.2015 / 07:57