08/01/14 11:58:06
// >>801
#include <stdio.h>
#include <string.h>
void func(int width, const char * str)
{
int len = strlen(str);
for (int ic = 0; ic <= len; ++ic) {
printf("\r%*.*s", width, ic, str);
fflush(stdout);
sleep(1);
}
for (int ic = 0; ic < width; ++ic) {
printf("\r%*s%*s", width - 1 - ic,
ic < width - len ? str : str + ic + 1 - width + len,
ic + 1, "");
fflush(stdout);
sleep(1);
}
}
int main()
{
func(20, "abcde");
return 0;
}