So I have a text file called num.txt that has a string of integers separated by a space.
So let's say num.txt contains: 5 3 21 64 2 5 86 52 3
I want to open the file in read format and get the numbers. So I can say
int iochar;
FILE *fp;
fp = fopen("num.txt", "r");
while ((iochar=getc(fp)) !=EOF){
if(iochar!=' '){
printf("iochar= %d\n", iochar); //this prints out the ascii of the character``
}
^this works for single-digit numbers. but how should I handle numbers with two or three or more digits?