Hi everybody..
I have a question about pointers and text files..
Well the case is so, that I have write a program for shcool, where I got a long list of soccer games as txt file.
I have to use that txt. to find out on which of the matches the teams have scoret most of the goals.
Now the problem here is, I don't have a clue about, how I can use the data that is inside the txt..
This is what I have for now..
#include <stdio.h>
#include<string.h>
#define MAX_LEN 200
int main(void)
{
FILE *inp;
char name[MAX_LEN], name2[MAX_LEN];
int score;
long maal;
inp =fopen("superliga.txt", "r");
if (inp != NULL) {
fscanf(inp, "%s ", name);
printf("%s ", name);
fclose(inp);
}
else {
printf("Cannot find the file");
}
return 0;
}
- Is there a way to use sscanf on the file??
I want to be able to get some data from the txt file and be able to do some math and print it out again..
Any idea is appreciated