I am trying to open and read a .txt file that simply contains a 2 digit number from 00 to 99.
Currently the file contains the following numbers: 05
When I read the first two values with fgets(), I instead get 48 and 53, and I've noticed whatever number I put in there, the number that fgets() grabs is 48 higher. While I could just subtract 48 from the number like I am doing now, I would like to figure out what I am doing wrong so that I don't have to do that. Here is the relevant section of my code:
char buff[3];
FILE *fp;
fp = fopen("savedata/save.txt","r");
fgets(buff, 3, fp);
SampleLevelIndex = (buff[0]-48)*10 + buff[1]-48;
fclose(fp);