Putting it all together
void reformat(FILE* in, FILE* out, int width) {
Line l(width); Token t(in);
while (t.type() != END) {
if (t.type() == BREAK) {
l.print(out); l.reset();
fprintf(out, ``\n'');
} else {
if (!l.canfit(t.word())) {
l.print(out); l.reset();
}
l.append(t.word());
}
t = Token(in);
}
l.print(out);
}