No problem. Note that you didn't use the fgets followed by *scanf idiom correctly. The *scanf shouldn't have been an fscanf but an sscanf, taking input from the line you read with fgets. One good thing about this technique is that you can ensure the lines have the correct number of values, something like the following code, which will consider any of these lines as an error:
1 2 3
1 2 3 4 5
1 2 x 3 4
1 2 3 4 x
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define INPUT_FILE "data.txt"
typedef struct Record {
int no, kod, puan, offset;
} Record;
int main() {
FILE *fin = fopen(INPUT_FILE, "r");
if (!fin) {
printf("Error: cannot open input file %s\n", INPUT_FILE);
exit(EXIT_FAILURE);
}
int rec_count = 0;
char line[1024];
for (int line_no = 0; fgets(line, sizeof line, fin); ++line_no) {
if (line[strspn(line, " \t\n")] == '\0')
continue; // skip blank lines
// ensure line has exactly 4 integers
int a, b, c, d;
char ch;
if (sscanf(line, "%d%d%d%d %c", &a, &b, &c, &d, &ch) != 4)
{
printf("Error: bad line #%d:\n%s\n", line_no + 1, line);
exit(EXIT_FAILURE);
}
++rec_count;
}
Record *recs = malloc(rec_count * sizeof *recs);
rewind(fin);
for (int i = 0;
i < rec_count && fscanf(fin, "%d%d%d%d", &recs[i].no,
&recs[i].kod,
&recs[i].puan,
&recs[i].offset) == 4;
++i)
;
fclose(fin);
for (int i = 0; i < rec_count; ++i)
printf("%d %d %d %d\n", recs[i].no,
recs[i].kod,
recs[i].puan,
recs[i].offset);
free(recs);
return 0;
}