输出字符串,以及使用退格删除字符串

#include <time.h>
#include <stdio.h>
#include <string.h>

int sleep(unsigned long x)
{
    clock_t c1 = clock(), c2;
    do {
        if ((c2 = clock()) == (clock_t)-1)    
            return 0;
    } while (1000.0 * (c2 - c1) / CLOCKS_PER_SEC < x);
    return 1;
}

int main(void)
{
    int  i;
    char name[] = "BohYoh Shibata";            
    int  name_len = strlen(name);            
    while (1) {        
        for (i = 0; i < name_len; i++) {    
            putchar(name[i]);
            fflush(stdout);
            sleep(500);
        }
        for (i = 0; i < name_len; i++) {    
            printf(" ");
            fflush(stdout);
            sleep(500);
        }
    }
    return 0;
}
原文地址:https://www.cnblogs.com/sea-stream/p/11037579.html