c - PDCurses mvprintw error with structure -
i'm using pdcurses , want show list of films it.
my code 1 :
typedef struct{ int nid; /* id du film */ int nid_genre; /* id du genre */ int nid_distributeur; /* id du distributeur */ char* psztitre; /* titre du film */ char* pszresume; /* resumé du film */ char* pszdate_debut; /* date de début du film */ char* pszdate_fin; /* date de fin du film */ int nduree; /* durée du film */ int nannee; /* année du film */ struct films_new* pnext; /* pointeur sur le prochain film */ }films_new; typedef films_new * pfilms_new; int displaylistfilms(){ pfilms_new pfilm; int ncount=0,nsizestring; int i=9; window *menu_win; int startx = 0; int starty = 0; initscr(); start_color(); /* start color functionality */ clear(); noecho(); cbreak(); /* line buffering disabled. pass on */ startx = (180 - width) / 2; starty = (40 - height) / 2; init_pair(1, color_green, color_black); attron(color_pair(1)); attron(a_bold); mvprintw(1, startx+6, "*************************************\n"); mvprintw(2, startx+6, "**** ******"); mvprintw(3, startx+6, "**** liste of films ******"); mvprintw(4, startx+6, "**** ******"); mvprintw(5, startx+6, "*************************************"); mvprintw(7, 0,entete_f); refresh(); if ((pfilm = prootfilm) == null) return 0; while (pfilm) { mvprintw(i, 0, (char *)pfilm->nid); mvprintw(i, 5, (char *)pfilm->nid_genre); mvprintw(i, 10, (char *)pfilm->nid_distributeur); mvprintw(i, 15, pfilm->psztitre); mvprintw(i, 20, pfilm->pszresume); mvprintw(i, 25, pfilm->pszdate_debut); mvprintw(i, 30, pfilm->pszdate_fin); mvprintw(i, 35, (char *)pfilm->nduree); mvprintw(i, 40, (char *)pfilm->nannee); pfilm = pfilm->pnext; ncount++; i++; } return ncount;
}
why not working? , why working if put mvprintw(i,0,"toto")?
pleeeease !!!! need next month :)
from code, looks like, usage of mvprintw()
wrong. per man page, synax is
int mvprintw(int y, int x, char *fmt, ...);
so, need write code like
mvprintw(i, 0, "%d", pfilm->nid); //for ints . . mvprintw(i, 15, "%s", pfilm->psztitre); // strings
Comments
Post a Comment