char teritoriuDeAtacat(char* pos, int nr) { int i; char c; conturColorat(START_TER_LIN, START_TER_COL, 5, 32, COL_INTREBARE); chenarColorat(START_TER_LIN + 1, START_TER_COL + 1, 3, 30, COL_FUNDAL_INTREBARE, "Trebuie sa ataci un teritoriu."); mvaddstr(START_TER_LIN + 2, START_TER_COL + 1, "Alege dintre: "); mvaddstr(START_TER_LIN + 3, START_TER_COL + 4, "["); for (i=0; i<nr; i++) addch(pos[i]); addch(']'); CAPAT(); noecho(); refresh(); timeout(-1); for (;;) { c = getch(); for (i=0; i<nr; i++) if (pos[i] == toupper(c)) return toupper(c); } }
void moveenemy() { double d; int oldr, oldc; oldr = row; oldc = column; if (fuel > 0){ if (row + dr <= LINES-3 && row + dr > 0) row += dr; if (column + dc < COLS-1 && column + dc > 0) column += dc; } else if (fuel < 0){ fuel = 0; mvaddstr(0,60,"*** Out of fuel ***"); } d = (double) ((row - MIDR)*(row - MIDR) + (column - MIDC)*(column - MIDC)); if (d < 16){ row += (rnd(9) - 4) % (4 - abs(row - MIDR)); column += (rnd(9) - 4) % (4 - abs(column - MIDC)); } clock--; mvaddstr(oldr, oldc - 1, " "); if (cross) target(); mvaddstr(row, column - 1, "/-\\"); move(LINES-1, 24); printw("%3d", torps); move(LINES-1, 42); printw("%3d", fuel); move(LINES-1, 57); printw("%3d", clock); refresh(); signal(SIGALRM, moveenemy); alarm(1); }
int main(){ initscr(); if(has_colors() == TRUE){ start_color(); //------------前景色,--背景色 //支持8套顏色,1-8 init_pair(1,COLOR_RED,COLOR_WHITE); init_pair(2,COLOR_BLUE,COLOR_GREEN); init_pair(3,COLOR_WHITE,COLOR_BLUE); //bkgd('a'|COLOR_PAIR(3)); bkgd(COLOR_PAIR(3)); } box(stdscr,'|','-'); mvaddch(1,10,'A'|A_BOLD); mvaddch(3,10,'A'|A_BLINK|A_UNDERLINE|COLOR_PAIR(2)); mvaddch(5,10,'A'|A_REVERSE|COLOR_PAIR(1)); mvaddch(7,10,'A'|A_DIM); mvaddch(8,10,ACS_PI); attron(COLOR_PAIR(1)); mvaddstr(6,20,"Hello 純!"); attroff(COLOR_PAIR(1)); attron(COLOR_PAIR(2)|A_BLINK); mvaddstr(10,20,"塔尼!"); attroff(COLOR_PAIR(2)|A_BLINK); mvprintw(9,10,"line:%d,v:%d",LINES,COLS); getch(); endwin(); return 0; }
void DisplayTiles() { int Line, Peg, SlotNo; char TileBuf[BUFSIZ]; erase(); mvaddstr(1, 24, "T O W E R S O F H A N O I"); mvaddstr(3, 34, "SJR 1990"); mvprintw(19, 5, "Moves : %d", NMoves); attrset(A_REVERSE); mvaddstr(BASELINE, 8, " "); for(Line=TOPLINE; Line<BASELINE; Line++) { mvaddch(Line, LEFTPEG, ' '); mvaddch(Line, MIDPEG, ' '); mvaddch(Line, RIGHTPEG, ' '); } mvaddch(BASELINE, LEFTPEG, '1'); mvaddch(BASELINE, MIDPEG, '2'); mvaddch(BASELINE, RIGHTPEG, '3'); attrset(A_NORMAL); /* Draw tiles */ for(Peg=0; Peg<NPEGS; Peg++) { for(SlotNo=0; SlotNo<Pegs[Peg].Count; SlotNo++) { memset(TileBuf, ' ', Pegs[Peg].Length[SlotNo]); TileBuf[Pegs[Peg].Length[SlotNo]] = '\0'; attrset(COLOR_PAIR(LENTOIND(Pegs[Peg].Length[SlotNo]))); mvaddstr(BASELINE-(SlotNo+1), (int)(PegPos[Peg] - Pegs[Peg].Length[SlotNo]/2), TileBuf); } } attrset(A_NORMAL); refresh(); }
void show_vmstat_top(vmtotal_t *Total, uvmexp_sysctl_t *uvm, uvmexp_sysctl_t *uvm1) { float f1, f2; int psiz; int i, l, c; struct { struct uvmexp_sysctl *uvmexp; } us, us1; us.uvmexp = uvm; us1.uvmexp = uvm1; putint(ucount(), STATROW, STATCOL, 3); putfloat(avenrun[0], STATROW, STATCOL + 17, 6, 2, 0); putfloat(avenrun[1], STATROW, STATCOL + 23, 6, 2, 0); putfloat(avenrun[2], STATROW, STATCOL + 29, 6, 2, 0); mvaddstr(STATROW, STATCOL + 53, buf); putint(Total->t_rq - 1, PROCSROW + 1, PROCSCOL + 3, 3); putint(Total->t_dw, PROCSROW + 1, PROCSCOL + 6, 3); putint(Total->t_sl, PROCSROW + 1, PROCSCOL + 9, 3); PUTRATE(us, us1, uvmexp->swtch, GENSTATROW + 1, GENSTATCOL - 1, 7); PUTRATE(us, us1, uvmexp->traps, GENSTATROW + 1, GENSTATCOL + 7, 6); PUTRATE(us, us1, uvmexp->syscalls, GENSTATROW + 1, GENSTATCOL + 14, 6); PUTRATE(us, us1, uvmexp->intrs, GENSTATROW + 1, GENSTATCOL + 21, 5); PUTRATE(us, us1, uvmexp->softs, GENSTATROW + 1, GENSTATCOL + 27, 6); PUTRATE(us, us1, uvmexp->faults, GENSTATROW + 1, GENSTATCOL + 34, 6); /* Last CPU state not calculated yet. */ for (f2 = 0.0, psiz = 0, c = 0; c < CPUSTATES; c++) { i = cpuorder[c]; f1 = cputime(i); f2 += f1; l = (int) ((f2 + 1.0) / 2.0) - psiz; if (c == 0) putfloat(f1, GRAPHROW, GRAPHCOL + 1, 5, 1, 0); else putfloat(f1, GRAPHROW, GRAPHCOL + 10 * c + 1, 5, 1, 0); mvhline(GRAPHROW + 2, psiz, cpuchar[c], l); psiz += l; } PUTRATE(us, us1, uvmexp->pageins, PAGEROW + 2, PAGECOL + 5, 5); PUTRATE(us, us1, uvmexp->pdpageouts, PAGEROW + 2, PAGECOL + 10, 5); PUTRATE(us, us1, uvmexp->pgswapin, PAGEROW + 3, PAGECOL + 5, 5); PUTRATE(us, us1, uvmexp->pgswapout, PAGEROW + 3, PAGECOL + 10, 5); }
void getstring(char *cp, int mx) { char *inptr; /* pointer into string for next string */ int x, y; /* original x, y coordinates on screen */ int ch; /* input */ getyx(stdscr, y, x); /* get coordinates on screen */ inptr = cp; *inptr = '\0'; /* clear string to start */ --mx; /* reserve room in string for nul terminator */ do /* get characters and process */ { if (Echo) mvaddstr(y, x, cp); /* print string on screen */ clrtoeol(); /* clear any data after string */ refresh(); /* update screen */ ch = getchar(); /* get character */ switch (ch) { case CH_NEWLINE: /* terminate string */ case CH_RETURN: break; case CH_REDRAW: /* redraw screen */ clearok(stdscr, TRUE); continue; default: /* put data in string */ if (ch == Ch_Erase) { /* back up one character */ if (inptr > cp) --inptr; break; } else if (ch == Ch_Kill) { /* back up to original location */ inptr = cp; break; } else if (isprint(ch) || Wizard) { /* printing char; put in string */ *inptr++ = ch; } } *inptr = '\0'; /* terminate string */ } while (ch != CH_NEWLINE && ch != CH_RETURN && inptr < cp + mx); }
int main(void) { int flag=0; initscr(); atexit(quit); clear(); noecho(); curs_set(0); cbreak(); keypad(stdscr, 1); start_color(); init_pair(1, COLOR_YELLOW, COLOR_BLUE); init_pair(2, COLOR_BLACK, COLOR_WHITE); init_pair(3, COLOR_BLACK, COLOR_YELLOW); win1 = newwin(10, 25, 5, 10); win2 = newwin(10, 25, 10, 15); box(win1, ACS_VLINE, ACS_HLINE); box(win2, ACS_VLINE, ACS_HLINE); pan1 = new_panel(win1); pan2 = new_panel(win2); bkgd(COLOR_PAIR(1)); wbkgd(win1, COLOR_PAIR(2)); wbkgd(win2, COLOR_PAIR(3)); mvaddstr(2,4, "F9 beendet das Programm"); mvwaddstr(win1, 2, 3, "Druecke eine Taste"); mvwaddstr(win2, 7, 3, "Druecke eine Taste"); update_panels(); doupdate(); while(getch() != KEY_F(9)) { if (flag==0) { top_panel(pan1); flag = 1; } else { top_panel(pan2); flag = 0; } update_panels(); doupdate(); } return (0); }
prboard() { reg PLAY *pp; reg int i, j, k, temp; for (k = 0; k < 2; k++) { pp = &Player[k]; temp = k * COMP_STRT + CARD_STRT; for (i = 0; i < NUM_SAFE; i++) if (pp->safety[i] == S_PLAYED && !pp->sh_safety[i]) { mvaddstr(i, temp, C_name[i + S_CONV]); if (pp->coups[i]) mvaddch(i, temp - CARD_STRT, '*'); pp->sh_safety[i] = TRUE; } show_card(14, temp, pp->battle, &pp->sh_battle); show_card(16, temp, pp->speed, &pp->sh_speed); for (i = C_25; i <= C_200; i++) { reg char *name; reg int end; if (pp->nummiles[i] == pp->sh_nummiles[i]) continue; name = C_name[i]; temp = k * 40; end = pp->nummiles[i]; for (j = pp->sh_nummiles[i]; j < end; j++) mvwaddstr(Miles, i + 1, (j << 2) + temp, name); pp->sh_nummiles[i] = end; } } prscore(TRUE); temp = CARD_STRT; pp = &Player[PLAYER]; for (i = 0; i < HAND_SZ; i++) show_card(i + 6, temp, pp->hand[i], &pp->sh_hand[i]); mvprintw(6, COMP_STRT + CARD_STRT, "%2d", Topcard - Deck); show_card(8, COMP_STRT + CARD_STRT, Discard, &Sh_discard); if (End == 1000) { move(EXT_Y, EXT_X); standout(); addstr("Extension"); standend(); } wrefresh(Board); wrefresh(Miles); wrefresh(Score); }
void WDL_CursesEditor::draw_bottom_line() { if (m_bottom_margin>0) { mvaddstr(LINES-1,0,"Ctrl+("); #define DO(x,y) { attrset(m_color_bottomline|A_BOLD); addstr(x); attrset(m_color_bottomline&~A_BOLD); addstr(y);} DO("F","ind "); DO("","ma"); DO("T",""); DO("","ch"); #undef DO addstr(")"); } }
static void ui_draw(Ui *ui) { UiCurses *uic = (UiCurses*)ui; erase(); ui_arrange(ui, uic->layout); for (UiCursesWin *win = uic->windows; win; win = win->next) ui_window_draw((UiWin*)win); if (uic->info[0]) { attrset(A_BOLD); mvaddstr(uic->height-1, 0, uic->info); } wnoutrefresh(stdscr); }
void GameField::drawCurrentTetromino(Tetromino& tetromino) const{ for(int i = 0; i < tetromino.getTetrominoPieceCount() ; ++i){ std::pair<int, int> tetrominoPiece = tetromino.getTetrominoPiece(i); int x = tetromino.getX() + 2 * tetrominoPiece.first; //TODO: CONNECT TO TETRIS.HPP FOR THE THICKNESS int y = tetromino.getY() + 1 * tetrominoPiece.second; color_set(tetromino.getColorID(), 0); for(int height = 0; height < 1; ++height){ for(int width = 0; width < 2; ++width){ mvaddstr(y + height, x + width, " "); } } } }
void render_piles(Piles * p, char * chr, int color_pairs) { int i, n; int * b; for (i = 0; i < p->height; ++i){ for (n = 0; n < p->width; ++n){ if (0 != p->point[i][n]){ color_on(color_pairs); mvaddstr(i + p->left_top.row,n + p->left_top.col,chr); color_off(color_pairs); move(0,0); } } } }
int app_init(void) { //initscr(); clear(); noecho(); keypad(stdscr, TRUE); box(stdscr, ACS_VLINE, ACS_HLINE); attron(A_UNDERLINE); mvaddstr(1, 20, PROG_NAME); mvaddstr(1, 33, FS_LIST_TITLE); attroff(A_UNDERLINE); refresh(); attron(A_BOLD); mvaddstr(3, 3, "Filesystem Node"); mvaddstr(3, 23, "Mount Directory"); mvaddstr(3, 43, "Filesystem Type"); attroff(A_BOLD); refresh(); // Y X Pos FS_SPARE = newwin(10,72,4,1); // Spare Window box(FS_SPARE, ACS_VLINE, ACS_HLINE); FS_LIST = newwin(8,70,5,2); //box(FS_LIST, ACS_VLINE, ACS_HLINE); wrefresh(FS_SPARE); wrefresh(FS_LIST); scrollok(FS_LIST, TRUE); return 0; }
main() { initscr(); clear(); mvaddstr(10,20,"hello"); refresh(); sleep(5); reset_shell_mode(); system("/bin/sh"); reset_prog_mode(); clearok(stdscr,TRUE); refresh(); getch(); endwin(); }
screen() { register int r,c,n; int i; clear(); i = rnd(100); for (n=0; n < i; n++){ r = rnd(LINES-3) + 1; c = rnd(COLS); mvaddch(r, c, '.'); } mvaddstr(LINES-1-1,21,"TORPEDOES FUEL TIME"); refresh(); }
void Simulator (Vehicle *vehicle, char *type, int distance) { srand (time (NULL)); int clock = 0, obstacle = 0, at_destination = 0; InitScreen (distance, type); attrset (A_BOLD); while (! at_destination && distance > 0) { mvaddstr (17, 19, "Driving... "); Moving (vehicle, clock++, obstacle, distance, 0, "[]O>"); at_destination = vehicle->Drive (); if ((rand () % 10) == 0 && ! at_destination) { Crashing (vehicle, clock++, obstacle++, distance, 1); mvaddstr (17, 19, "Backing up... "); vehicle->Reverse (); Moving (vehicle, clock++, obstacle, distance, 0, "<O[]"); Moving (vehicle, clock++, obstacle, distance, -1, "<O[]"); mvaddstr (17, 19, "Passing... "); Moving (vehicle, clock++, obstacle, distance, -1, "[]O>"); vehicle->Reverse (); at_destination = vehicle->Pass (); } } mvaddstr (17, 19, "Turning off... "); Moving (vehicle, clock++, obstacle, distance, 0, "[]O>"); attrset (A_NORMAL); refresh (); }
/* Draws the UI using a pre-made UI */ void drawlistfs() { DrawFSDefaultScreen("List Mounted Filesystems"); attron(A_BOLD); mvaddstr(3, 4, "Device"); mvaddstr(3, 26, "Mount Directory"); mvaddstr(3, 60, "Filesystem Type"); attroff(A_BOLD); refresh(); if(ListFS < 1) { wclear(FSPAD); counter_FS=15; wmove(FSPAD, 15,2); listfs(); } else { prefresh(FSPAD, 15, 1, 5, 3, 14, 74); } }
int main() { initscr(); int y=1; double price; int number; double money; double sum=0; mvprintw(0,5,"======================MENU==================="); while(1){ mvaddstr(y,5,"Price"); mvaddstr(y,15,"Number"); mvaddstr(y,25,"Money"); mvscanw(y,11,"%lf",&price); if(price<0){ break; } mvscanw(y,22,"%d",&number); money=number*price; mvprintw(y,31,"%.2f",money); sum+=money; refresh(); ++y; } move(y,0); clrtoeol(); mvprintw(y,25,"Acconut:%.2f",sum); refresh(); getch(); endwin(); return 0; }
void drawmenu(int item) { int c; start_color(); init_pair(1,COLOR_BLUE,COLOR_BLACK); /*Blue text with black background*/ char mainmenu[] = "Main Menu"; char menu[MENUMAX][21] = {"Log in","Register","Find train","Check availaibility","Cancel ticket","Check status ac", "Check status sleeper", "Exit/Logout"}; clear(); attrset(A_BOLD); attron(COLOR_PAIR(1)); /*Initializing the colour pair and bold attribute*/ addstr("Welcome to rail booking services"); mvaddstr(1,0,"Main Menu"); attroff(A_BOLD); attroff(COLOR_PAIR(1)); /*End of bold and colour*/ for(c = 0; c < MENUMAX; c++) { if( c == item ) attron(A_REVERSE); /* highlight selection */ mvaddstr(3 + (c * 2),20,menu[c]); attroff(A_REVERSE); /* remove highlight */ } mvaddstr(17,25,"Use arrow keys to move; Right arrow key to select to select:"); refresh(); }
void startNewScreen(int score, Tetromino *tetromino) { int x, y; erase(); // clear screen completely for(x = 0; x < 38; x++) for(y = 0; y < 14; y++) crt[y][x] = ' '; mvaddstr(0,0,"------------"); mvaddstr(1,14, "Score:"); for(y = 0; y < 14; y++) { putChar('|', 0, y); putChar('|', 11, y); } // for y mvaddstr(15,0,"------------"); mvaddstr(16,0,"Horizontal borders are not in CUSP"); showScore(score); startTetromino(tetromino); refresh(); } // StartNewScreen()
static int find_text(int index) { int i = 0, value = index, max_y = 0, max_x = 0, c = 0, y = 0, x = 0; unsigned long keymask = (F3_BIT|F10_BIT); char buf[256]; (void)memset(buf, '\0', 256); getmaxyx(stdscr, max_y, max_x); if ( (max_y < MIN_Y) || (max_x < MIN_X) ) { return (-1); } move(max_y-10, 0); clrtobot(); mvaddch(max_y-10, 0, '+'); mvaddch(max_y-10, max_x-1, '+'); mvaddch(max_y-1, 0, '+'); mvaddch(max_y-1, max_x-1, '+'); for ( x = 1; x < max_x-1; x++ ) { mvaddch(max_y-10, x, '-'); mvaddch(max_y-1, x, '-'); } for ( y = max_y-9; y < max_y-1; y++ ) { mvaddch(y, 0, '|'); mvaddch(y, max_x-1, '|'); } mvaddstr(max_y-9, (max_x/2)-2, "Find"); refresh(); c = io_text(max_y-7, 4, buf, 256, keymask); if ( KEY_F(3) == c ) { value = FIND_CANCEL; } else if ( KEY_F(10) == c ) { value = FIND_EXIT; } else if ( KEY_ENTER == c ) { if ( '\0' != buf[0] ) { if ( NULL != (srch_txt = strdup(buf)) ) { value = find_next(index); } else { value = FIND_CANCEL; } } else { value = FIND_CANCEL; } } else { value = FIND_CANCEL; } move(max_y-10, 0); clrtobot(); return (value); }
main() { int x = StartX; int y = StartY; int ch; initial(); box(stdscr,'|','-'); attron(A_REVERSE); mvaddstr(0,20,"jiwenibao curses program"); attroff(A_REVERSE); move(x,y); do{ ch = getch(); switch(ch) { case KEY_UP: --y; break; case KEY_DOWN: ++y; break; case KEY_RIGHT: ++x; break; case KEY_LEFT: --x; break; case ' ': ++y; x=0; break; case '\t': x+=7; break; case KEY_BACKSPACE: mvaddch(y,--x,' '); break; case 27: endwin(); exit(1); default: addch(ch); x++; break; } move(y,x); }while(1); }
void menu_redraw_prompt (MUTTMENU * menu) { if (menu->dialog) { if (option (OPTMSGERR)) { mutt_sleep (1); unset_option (OPTMSGERR); } if (*Errorbuf) mutt_clear_error (); SETCOLOR (MT_COLOR_NORMAL); mvaddstr (LINES - 1, 0, menu->prompt); clrtoeol (); } }
void gui_entry_set_prompt(const char *str) { if (str != NULL) { if (permanent_prompt) return; g_free_not_null(prompt); prompt = g_strdup(str); promptlen = strlen(prompt); } set_color(stdscr, 0); mvaddstr(LINES-1, 0, prompt); entry_screenpos(); entry_update(); }
void basicSetupScreen(int level) { //add basic information for first launch drawBox(70,11,40,10,1); mvprintw(4,94,"%d",level); char money[15]; sprintf(money, "%d", STARTINGMONEY); mvaddstr(6,93,money); //mvaddch(8,93,'0'); attron(COLOR_PAIR(3)); addBoxChoiceOption(1); attroff(COLOR_PAIR(3)); updateUnitChoice(0); }
void SelectDistance (int argc, char **argv, int& distance) { if (argc >= 2) distance = abs (atoi (argv [1])); else { echo (); attrset (A_BOLD); mvaddstr (20, 23, "How far do you want to drive? "); scanw ("%i", &distance); distance = abs (distance); attrset (A_NORMAL); noecho (); refresh (); } }
main() { Queue<V2> centipede; int currentDirection; int inputChar; V2 currentHead; // Configure ncurses. configureNcurses(); // Fill queue (all centipede segments at start position). currentHead.row = START_ROW; currentHead.col = START_COL; for (int i = 0; i < QUEUE_SIZE; ++i) centipede.pushAndPop(currentHead); // Draw instructions and initial centipede. attron(COLOR_PAIR(2)); mvaddstr(1, 3, "USE ARROW KEYS TO MOVE, CTRL-C TO QUIT"); attroff(COLOR_PAIR(2)); drawCentipede(centipede, false); refresh(); // Process input until killed. currentDirection = KEY_RIGHT; while (true) { // Show current state, then check for input. usleep(SLEEP_MICROSECONDS); inputChar = getch(); if (inputChar != ERR) currentDirection = inputChar; // When input received, erase old centipede. drawCentipede(centipede, true); // Then use new input to update centipede. updatePosition(currentHead, currentDirection); centipede.pushAndPop(currentHead); // Then draw new centipede, and refresh. drawCentipede(centipede, false); refresh(); } // Clean up ncurses. (Re-display cursor.) curs_set(1); }
/* Draws out the main Screen */ int drawfstui(void) { clear(); /* Clear Screen */ getmaxyx(stdscr, y,x); box(stdscr, ACS_VLINE, ACS_HLINE); // Draw Box around Main Screen attron(A_UNDERLINE); // Turn on Underline mvprintw(1, 32, "%s", fsmgr_title); // Write Title on line 1 and 32 attroff(A_UNDERLINE); // Turn off Underline /* Header for the FS List Box and other parts */ attron(A_BOLD); // Turn on bold /* see filesysmgr.h for these varibles */ mvaddstr(3,3, fsnode_title); // Filesystem Node (Devices) mvaddstr(3,27, mountpt_title); // Mount Point mvaddstr(3, 48, fstype_title); // Filesystem Type mvaddstr(3, 60, fsopts_title); // Filesystem Opts /* Bottom Part of the Screen */ mvaddstr(17, 2, FS_OPT_TITLE); mvaddstr(18, 2, FSMGR_OPT1); /* Options */ mvaddstr(y-4,2, FKEY1); /* Bottom Bar */ mvaddstr(y-3,2, FKEY2); /* Bottom Bar */ attroff(A_BOLD); // Turn off bold /* End of Header for TUI */ fssparebox = newwin(12,70,4,2); box(fssparebox, ACS_VLINE, ACS_HLINE); fslistbox = newwin(10,68,5,3); // Make New Window for filesystem list box //box(fslistbox, ACS_VLINE, ACS_HLINE); // Box that Window scrollok(fslistbox, TRUE); // Enable Scrolling /* Refresh */ refresh(); // Refresh Main Screen wrefresh(fssparebox); wrefresh(fslistbox); // Refresh filesystem List Window return 0; }
/* Whack up an informational message on the status line, in stand-out */ void msgYap(const char *fmt, ...) { va_list args; char *errstr; int attrs; errstr = (char *)alloca(FILENAME_MAX); va_start(args, fmt); vsnprintf(errstr, FILENAME_MAX, fmt, args); va_end(args); attrs = getattrs(stdscr); attrset(A_REVERSE); mvaddstr(StatusLine, 0, errstr); attrset(attrs); refresh(); }
void *game_listener(void *arg) { (void)arg; printf("in listener\n"); /* while (1) { x += 1; } return NULL;*/ const int msg_len = 100; char server[msg_len]; while (fgets(server, msg_len, pp) != NULL) { mvaddstr(12, 12, server); refresh(); //printf("from server: %s\n", server); } return NULL; }