char *ch;
ch = fgets(buffer, 100, file);
printf("%s1\n", ch);
printf("A(x) = ");
while (!feof(file)) {
if (fscanf(file, "(%d,%d)", &a[i].coef, &a[i].exp) != 2) {
I have this code and I'm trying to write poly A. but when I run this, I get second row of input for A. There is no problem when I print ch, but there is problem when I'm trying to print A. The input is:
(5,2)(4,6)(5,7)(7,3)(1,0)(9,1)(5,5)
(5,1)(8,0)(8,6)(3,5)(1,3)(7,2)(9,7)(5,4)
I want the first row to be in A.
I tried to change fscanf(file)
but I wasn't able to fix it.