#include <iostream>
#include <cstdlib>
#include <ncurses.h>
int main(){
char command[] = "My command"constchar *str = (constchar*) std::system(command);
int i = 0;
initscr();
while(1){
system("sleep 1");
mvprintw(i, 0, str); //mvprintw(i, 0, "%s", str) tells me that str is null.
std::cout << "\r" << std::flush;
i++;
refresh();
}
endwin();
return 0;
}
And also, I'm kind of a newbie, could anyone tell me how to finish the program while it's executing? If I press Ctrl + Z it finishes because of the ncurses library but it only stops the process, it's still running on the background, then I have to kill the process manually.
I hope someone can give me a tip or guidance, thanks in advance! :D