pointers on text file?

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..
#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);
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


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion