0

Sorry for this simple question but I don't really understand how correctly create consol on C. I wanna have several dynamic lines that will be update. I know that I can use \r but it is only for one line. I want for several lines. system("cls") not working good for this. Maybe you can help me.

#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

int main() {
    int currInt = 0;

    while (true) {
        system("cls");

        printf("%d", currInt);

        currInt++;

        if (currInt == 5) {
            currInt = 0;
        }
    }
}

I will be have asynchronous input data that will be display on several lines and I need have update this screen. I think about system("cls") but it not clear screen in loop. Endless loop is important.

gsamaras
  • 71,951
  • 46
  • 188
  • 305

1 Answers1

1

I doubt it that printf() will help you achieve your goals. If I were you, I would give a shot with Ncurses. Check this question too: Where can I find a complete reference of the ncurses C API?

If this library won't satisfy you, then I would suggest curses.h. However I doubt this will do, since Ncurses is a modern implementation of the original curses.


For Windows: Is ncurses available for windows?

gsamaras
  • 71,951
  • 46
  • 188
  • 305