
Formal definition of polynomial for ease of programming.

{<sign><coeff><exponent>}*

<sign> ==> + | -

<coeff> ==> FLOAT

<exponent> ==> x | x^<degree> | []

<degree> ==> INTEGER

Use fscanf ( fid, "%lf", coeff );

Use fscanf ( fid, "%d", exponent ); or fgetc( fid )

Use fgetc (fid) and ungetc (char, fid) to examine characters.

Probably best to copy input stream into an array, removing
blanks as you go, and build a pointer to the array. One can
then read from the array just like from a file.

Most sophisticated.
|