Pause program after displaying ten characters

268 views Asked by At

I want to be able to do something like pause the program after displaying 10 characters of ASCII values and say Continue or something to resume. I use Visual Studio 2017 if that of any use.

1

There are 1 answers

8
lost_in_the_source On
char str[] = "This is my string of text that will be outputted. After every"
             " ten characters, this will be interrupted.\n";

size_t i;
for (i = 0; str[i] != '\0'; ++i) {
    putchar(str[i]);
    if (i % 10 == 0) {
        printf("Press any key to continue . . .\n");
        getchar();
    }
}