mvwprintw(main_screen, row, col, "%*.*s", REC_NUM_SIZE + 2, REC_NUM_SIZE + 2, ptr2);

The above mvwprintw command is part of the unix curses library

but can anyone explain what the "%*.*s" is doing, and is used just for the unix library curses?


Presumably, mvwprintw is just a wrapper around some form of printf, so unless you want to look at your documentation, we can only assume that the format modifier follows the same rules.

The asterisk means that a value will be supplied as a later argument. The first asterisk is the field width and the second is the precision. I'd recommend testing how it works by hard coding values. For example:

printf ( "%5.2s\n", "abcdefghijklmnopqrstuvwxyz" );