36 char s[LINE_LENGTH], t[LINE_LENGTH];
37 int32_t l_count_line, posi_count_line;
39 if (!(fp = fopen(filename,
"r")))
41 if (!fgets_skip(s, LINE_LENGTH, fp,
'!', 0))
43 if (strncmp(s,
"SDDS", 4) == 0 && isdigit(s[4]))
45 if (!fgets_skip(s, LINE_LENGTH, fp,
'!', 0) || !fgets_skip(s, LINE_LENGTH, fp,
'!', 0) || !fgets_skip(s, LINE_LENGTH, fp,
'!', 0))
47 posi_count_line = ftell(fp);
48 if (!fgets_skip(s, LINE_LENGTH, fp,
'!', 0))
50 l_count_line = strlen(s) - 1;
54 while (fgets(s, LINE_LENGTH, fp))
60 sprintf(t,
"%ld", count);
61 if ((
long)strlen(t) <= l_count_line && (fp = fopen(filename,
"r+"))) {
63 if (!(fseek(fp, posi_count_line, 0) != EOF && fputs(t, fp) != EOF)) {