Hello. This is a very simple question, but I can't seem to find something about it in here already. I want to read two integers from a file with C. My code now is this:
int main() {
FILE *fp;
int s[80];
int t;
if((fp=fopen("numbers", "r")) == NULL) {
printf("Cannot open file.\n");
} else {
fscanf(fp, "%d%d", s, &t);
printf("%d %d\n", s[0], s[1]);
}
return 0;
}
I get the first integer from the file, but the next one is just a random number. My file is like this:
100 54
Thanks in advance