Hi
I have a question regarding this code. This code is supposed to extract ASCII values from the input in the file testme.txt (which only contains: KMN) and then convert every character to ASCII (K = 75. M = 77, etc..) but for some reason the code only converts the first character.
I want to use fscanf only.
Code:
#include <stdio.h>
int main(void){
char ac;
FILE *inp, *outp;
inp = fopen("testme.txt","r");
outp = fopen("testme.out","w");
fscanf(inp,"%c",&ac);
printf("The number read from the file is %d.\n",ac);
fprintf(outp,"ASCII was %d.\n",ac);
fclose(inp);
fclose(outp);
return (0);
}