This is the final mini step I need to do before my program is complete.
a line has 85 chars from begining to end. I want to start the line with an *and end a line with a *. The problem is, that I don't know how long the ref, and check_number will take to print. How do I accomplish such thing?

fprintf(report, "*   Reference: %.10s%d\n         ", ref, check_number);

I would like it to always print like that, no matter how long the ref, and check_number is.

*   HDZK100                                              *
*   JCKSN101                                             *
*   AD102                                                *

.
.
and so on

I don't quite understand what do you want to do, but maybe using tab (\t) somewhere in the printf format string would solve your problem.

> %.10s%d
sprintf() this to a temporary string first, then use printf("%60s") or whatever to print that result in the field width you've chosen.

> %.10s%d
sprintf() this to a temporary string first, then use printf("%60s") or whatever to print that result in the field width you've chosen.

Thanks a bunch, that's what I was looking for.

This question has already been answered. Start a new discussion instead.