If you want to write out a whole line of characters (a string), you can do so with a single call to fputs. The definition of fputs is as follows:
int fputs ( const char * string, FILE * stream )
This function ignores whitespace and could have equally well been used in the variable-length string-reading and -writing example. This being the case, you might also have replaced the reading facility with a single call to the companion function fgets instead of multiple calls to fscanf. The definition of fgets is as follows:
int fgets ( char * string, int max_length, FILE * stream )
This would seem to be an elegant solution; fgets can read in a number of characters (limited by the max_length parameter) from an open ...