I understand that with a large string, you can print the first few characters with:
printf(".5s\n",string);
and with the bottom line, you can place it in space:
printf("% 5s\n",string);
Is there a way to reach both of them at once? those. fill it with 0 or a space if it's short, and truncate it if it's long?
source
share