I want a function that reads a line from a file, separates
the two variables (one string and one integer).
(I am going to use those variables later)..
The code so far:
void output_db()
{
for(;;)
{
char name[60];
int number;
if(!fgets(line, sizeof(line), fp))
break;
if(sscanf(line, "%s %d", name, &number) != 2)
{
fprintf(stderr, "error !\n");
continue;
}
fprintf(stdout, "%s %d", name, &number);
}
fclose(fp);
}
(*fp is global)
But the result is : "error ! error !".
The file film.db is exactly two lines by the way.
The file format looks like this:
First blood 1982
The shining 1980
Torbj�rn Kristoffersen
[EMAIL PROTECTED]