Code: C
static int iStart = 0;
static int iPad = 0;
char title[] = "abcdefghijklmnopqrstuvwxyz";
int titleLength = strlen(title), overChars;
char titleToShow[20];
if(titleLength > 20)
{
for(int i=iStart;i<20+iStart;i++)
titleToShow[i] = title[i];
iStart++;
titleToShow[i] = '\0';
}
else
{
// Before padding with spaces
for(int i=0;i<iPad;i++)
titleToShow[i] = ' ';
// Copying the characters
for(;i<titleLength;i++)
titleToShow[i] = title[i];
// After padding with spaces
for(;i<20;i++)
titleToShow[i] = ' ';
}
Just this is the handler to the timer where you pad based on the static variable.